Method in collections::map · HashMap coil-stdlib

HashMap::clear

pub fn clear()
Import
use collections::map::{HashMap};
Source: src/collections/map.hy

Removes every entry, keeping the bucket count.

Called on a HashMap value as value.clear(…).

Contracts#

Checked according to --contracts (see Contracts).

ensures self.len == 0

Examples#

use collections::map::{HashMap};
use tests::assert;
let m: HashMap<int, int> = HashMap::new();
m.insert(1, 10);
m.clear();
assert!(m.is_empty());
assert!(!m.contains(1));

See also#

↑ ↓ navigate ↵ open