Skip to main content

map_remove

Macro map_remove 

Source
macro_rules! map_remove {
    ($map:ident, $( $k:expr ),* $(,)?) => { ... };
}
Expand description

Use an existing map collection and remove key-value pairs.

Example:

let mut m = HashMap::from([(1, 2), (3, 4)]);
map_remove!(m, &1, &3);

Equivalent Rust std code with method remove:

let mut m = HashMap::from([(1, 2), (3, 4)]);
m.remove(&1);
m.remove(&3);