Skip to navigation
Create a nested hashmap with rust
28.02.23
Create a nested hashmap with rust let mut a : HashMap
> = HashMap::new(); let mut child: HashMap
= HashMap::new(); for i in &r { if !a.contains_key(&i["style"].to_string()) { println!("{:?}",i["style"]); child = HashMap::new(); } child.insert(i["child"].to_string(), i["stock"].to_string()); a.insert(i["style"].to_string(), child.clone()); } return a;
https://doc.rust-lang.org/std/collections/struct.HashMap.html
Reply
Anonymous
Information Epoch 1745506432
Files are bags of bytes.
Home
Notebook
Contact us