Crates.io | singlemap |
lib.rs | singlemap |
version | 0.1.6 |
source | src |
created_at | 2022-01-24 02:03:17.362255 |
updated_at | 2022-06-08 04:37:20.821911 |
description | rust single map |
homepage | |
repository | |
max_upload_size | |
id | 519955 |
size | 11,285 |
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")});
}