/**
 * Increment the count of key with v (insert new if not exists)
 **/
Increment the count of key with v (insert new if not exists)
Increment the count of key with v ( insert new if not exists )
fn inc_with<K: Hash + Eq>(counts: &mut HashMap<K, u64>, key: K, v: u64) {
    match counts.get_mut(&key) {
        Some(x) => *x = *x + v,
        None => {
            counts.insert(key, v);
        }
    }
}
fn inc_with < K : Hash + Eq > ( counts : & mut HashMap < K , u64 > , key : K , v : u64 ) { match counts . get_mut ( & key ) { Some ( x ) => * x = * x + v , None => { counts . insert ( key , v ) ; } } }
Increment the count of key with v (insert new if not exists)
Increment the count of key with v ( insert new if not exists )
counts
&mut HashMap<K, u64>
key
K
v
u64