redbpf
redbpf copied to clipboard
How to turn a map in to specific hashmap?
let map = Map::from_pin_file("pin_file").unwrap();
let hasmap = HashMap::<u32, u32>::new(&map).unwrap();
The hashmap
internally references map
, so I can't use hashmap
alone without a valid map
;
If there has a way like map::into::<HashMap>()
, it will be more convenient:
let map = Map::from_pin_file("pin_file").unwrap();
let hasmap: HashMap<u32, u32> = map.try_into().unwrap();
Hello @d0u9 It's really nice to see you again. Lucky day!
Thanks for your suggestion :+1: It looks like convenient and neat!