RandomState in std::hash - Rust (original) (raw)

Struct RandomState

1.76.0 · Source

pub struct RandomState { /* private fields */ }

Expand description

RandomState is the default state for HashMap types.

A particular instance RandomState will create the same instances ofHasher, but the hashers created by two different RandomStateinstances are unlikely to produce the same result for the same values.

§Examples

use std::collections::HashMap;
use std::hash::RandomState;

let s = RandomState::new();
let mut map = HashMap::with_hasher(s);
map.insert(1, 2);

Source§

1.7.0 · Source

Constructs a new RandomState that is initialized with random keys.

§Examples
use std::hash::RandomState;

let s = RandomState::new();

§

§

§

§

§

§