- Rust Quick Start Guide
- Daniel Arbuckle
- 182字
- 2021-06-10 19:46:03
Using the item's short name
We can also use the use keyword to tell Rust that we want to refer to an item in a different module by its short name. This is done by just writing use followed by the full name of the item we want to use. For example, use std::path::Path; allows us to use just the short name for that item (Path in this example) in the following instructions, until we come to the } that closes the section of code where our use keyword was written (or we come to the end of the module file, which amounts to the same thing).
We can use the same syntax to tell Rust that we want to use the name of a module, rather than an item in a module. For example, std::path is a valid command. That would allow us to use path::Path as the name of the Path item in subsequent code. This is frequently convenient, since it still keeps the external items boxed up and separate, while providing reasonably short and informative names to work with.
- R語言經(jīng)典實例(原書第2版)
- Drupal 8 Blueprints
- MATLAB圖像處理超級學習手冊
- 算法大爆炸:面試通關步步為營
- Getting Started with PowerShell
- Instant 960 Grid System
- Drupal 8 Module Development
- 區(qū)塊鏈技術與應用
- Mastering Xamarin.Forms(Second Edition)
- Visual C#.NET Web應用程序設計
- Clean Code in C#
- Go語言從入門到精通
- JavaScript從入門到精通(視頻實戰(zhàn)版)
- Anaconda數(shù)據(jù)科學實戰(zhàn)
- PHP+MySQL Web應用開發(fā)教程