类型别名
类型别名为另一种类型创建名称。这两种类型可以互换使用。
1. enum CarryableConcreteItem {
2. Left,
3. Right,
4. }
6. type Item = CarryableConcreteItem;
8. // Aliases are more useful with long, complex types:
9. use std::cell::RefCell;
10. use std::sync::{Arc, RwLock};
11. type PlayerInventory = RwLock<Vec<Arc<RefCell<Item>>>>;
This slide should take about 2 minutes.
C 语言程序员会认为这类似于 typedef。
