Trait map_ext::Update [] [src]

pub trait Update<K, V> {
    fn update<F>(&mut self, key: &K, f: F)
    where
        F: FnOnce(&mut V)
; }

Trait adding an update method to maps, allowing their entries to be updated.

Required Methods

Update the entry for the given key by applying a function to the value.

If there is an entry in the map corresponding to key, updates the value by applying the function f to it. Otherwise, if there is no entry, does nothing.

Arguments

  • key: the key to the entry to update
  • f: a function taking &mut V to update the entry's value

Implementors