نامهای مستعار تایپ
تایپ alias، نامی برای نوع دیگر ایجاد می کند. این دو نوع را می توان به جای هم استفاده کرد.
enum CarryableConcreteItem {
Left,
Right,
}
type Item = CarryableConcreteItem;
// Aliases are more useful with long, complex types:
use std::cell::RefCell;
use std::sync::{Arc, RwLock};
type PlayerInventory = RwLock<Vec<Arc<RefCell<Item>>>>;
This slide should take about 2 minutes.
برنامهنویسان C این را شبیه به typedef تشخیص میدهند.