Responses for exercises in Exercism.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

715 B

Hints

General

  • Upon fetching an entry using the entry method, the entry can be modified in-place after dereferencing it.

  • The or_insert method inserts the given value in the case when the entry is vacant, and returns a mutable reference to the value in the entry.

*counter.entry(key).or_insert(0) += 1;
  • The or_default method ensures a value is in the entry by inserting the default value if empty, and returns a mutable reference to the value in the entry.
*counter.entry(key).or_default() += 1;