Method in collections::map · HashMap coil-stdlib

HashMap::keys

pub fn keys() -> Vec<K>
Import
use collections::map::{HashMap};
Source: src/collections/map.hy

Returns the keys, in insertion order.

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

Returns#

Vec<K>

Contracts#

Checked according to --contracts (see Contracts).

ensures result.len() == self.len

Examples#

use collections::map::{HashMap};
use tests::assert;
let m: HashMap<string, int> = HashMap::new();
m.insert("x", 1);
m.insert("y", 2);
let ks = m.keys();
assert!(ks.len() == 2);
assert!(ks[0] == "x");

See also#

↑ ↓ navigate ↵ open