[][src]Struct fasthash::Seed

pub struct Seed(_);

Generate hash seeds

It base on the same workflow from std::collections::RandomState

Historically this function did not cache keys from the OS and instead simply always called rand::thread_rng().gen() twice. In #31356 it was discovered, however, that because we re-seed the thread-local RNG from the OS periodically that this can cause excessive slowdown when many hash maps are created on a thread. To solve this performance trap we cache the first set of randomly generated keys per-thread.

Later in #36481 it was discovered that exposing a deterministic iteration order allows a form of DOS attack. To counter that we increment one of the seeds on every RandomState creation, giving every corresponding HashMap a different iteration order.


use fasthash::{Seed, city};

city::hash128_with_seed(b"hello world", Seed::gen().into());


impl Seed[src]

pub fn gen() -> Seed[src]

Generate a new seed

Trait Implementations

impl Copy for Seed[src]

impl From<Seed> for u32[src]

impl From<Seed> for u64[src]

impl From<Seed> for (u64, u64)[src]

impl From<Seed> for (u64, u64, u64, u64)[src]

impl From<Seed> for u128[src]

impl Clone for Seed[src]

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for Seed[src]

Auto Trait Implementations

impl Send for Seed

impl Sync for Seed

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized

impl<T> BorrowMut for T where
    T: ?Sized

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized