集合
集合是一种无序且不重复的数据集合。本小节介绍集合的创建、添加和读取及使用示例。
创建集合
new 方法
let mut s = Set::<Int>::new();
with_capacity
方法let mut s = Set::<Int>::with_capacity(1);
添加数据
insert
方法
s.insert(1.into());
读取数据
get 方法
s.get(&Int::new(1));