Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•collection•hashmap•key•modify

			//Snipped code
            "map.entry($1key_str$2).or_insert(10);",
			"map.entry(key).and_modify(|e| { *e += 2 });",
			"",
			"if let Entry::Occupied(o) = map.entry(key) {",
			"   *o.into_mut() += 2;",
			"}",
			"*map.entry(key).or_insert(10)+=2;"
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
3+2 =