#hash-map #dict #add #simple-map

smap

Simple-Map:易于使用的 HashMap

6 个版本

0.3.0 2020年7月14日
0.2.2 2020年7月14日
0.1.1 2020年7月14日

#11 in #dict

MIT 许可证

4KB

smap -- Simple-Map

use smap::Dict;

fn main() {
    let mut e2c = Dict::new();
    e2c.add("a", "一隻");
    e2c.add("dog", "");
    e2c.add("cat", "");
    e2c.add("chase", "");
    e2c.add("bite", "");
    println!("{:?}", e2c.get("cat"));
    println!("{:?}", e2c.get("xxx"));
    assert!(e2c.get("cat") != None);
    assert!(e2c.get("xxx") == None);
}

运行

$ cargo run
   Compiling smap1 v0.1.0 (D:\ccc\ccc109a\se\rust\se\use\smap1)
    Finished dev [unoptimized + debuginfo] target(s) in 2.91s
     Running `target\debug\smap1.exe`
Some("")
None

无运行时依赖