Struct std::collections::hash_map::RandomState1.7.0[−][src]

pub struct RandomState { /* fields omitted */ }
Expand description

RandomState 是 HashMap 类型的默认状态。

特定的实例 RandomState 将创建 Hasher 的相同实例,但是由两个不同的 RandomState 实例创建的散列对于相同的值不太可能产生相同的结果。

Examples

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

Implementations

创建一个用随机键初始化的新 RandomState。

Examples

use std::collections::hash_map::RandomState;

let s = RandomState::new();
Run

Trait Implementations

将创建的哈希器的类型。

创建一个新的哈希器。 Read more

🔬 This is a nightly-only experimental API. (build_hasher_simple_hash_one #86161)

计算单个值的哈希值。 Read more

返回值的副本。 Read more

从 source 执行复制分配。 Read more

使用给定的格式化程序格式化该值。 Read more

创建一个新的 RandomState。

Auto Trait Implementations

Blanket Implementations

获取 self 的 TypeId。 Read more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

获得所有权后的结果类型。

通常通过克隆从借用数据中创建拥有的数据。 Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)

recently added

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。