#map #single #test

singlemap

rust single map

2 releases

0.1.6 Jun 8, 2022
0.1.5 Feb 23, 2022
0.1.1 Jan 24, 2022

#97 in #single

36 downloads per month
Used in 3 crates

Custom license

11KB
225 lines

singlemap

rust singlemap

更新 通过指针转换类型获得引用

#[macro_use]
extern crate singlemap;

#[test]
fn test_map(){
    single_push!("a",Box::new("aaaa".to_string()));
    let straa = single_get_unwrap!("a",Box<String>).clone();
    let refaa = single_get_ref!("a");
    println!("straa:{:?}",straa);
    println!("rustlaa:{:?}",refaa.cast_ref::<Box<String>>());
    single_get_ref_try!("a",Box<String>,|r:&Box<String>|{
        println!("single_get_try:{:?}",r);
    },{println!("error")});
}

Dependencies

~1.2–5.5MB
~24K SLoC