pub struct RandomState { /* fields omitted */ }
Expand description
RandomState
是 HashMap
类型的默认状态。
特定的实例 RandomState
将创建 Hasher
的相同实例,但是由两个不同的 RandomState
实例创建的哈希对于相同的值不太可能产生相同的结果。
use std::collections::HashMap;
use std::collections::hash_map::RandomState;
let s = RandomState::new();
let mut map = HashMap::with_hasher(s);
map.insert(1, 2);
Run
创建一个用随机键初始化的新 RandomState
。
use std::collections::hash_map::RandomState;
let s = RandomState::new();
Run
🔬 This is a nightly-only experimental API. (
build_hasher_simple_hash_one
#86161)
impl<T> Any for T where
T: 'static + ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
🔬 This is a nightly-only experimental API. (
toowned_clone_into
#41263)