pub(crate) struct RngSeedGenerator {
state: Mutex<FastRand>,
}
Expand description
A deterministic generator for seeds (and other generators).
Given the same initial seed, the generator will output the same sequence of seeds.
Since the seed generator will be kept in a runtime handle, we need to wrap FastRand
in a Mutex to make it thread safe. Different to the FastRand
that we keep in a
thread local store, the expectation is that seed generation will not need to happen
very frequently, so the cost of the mutex should be minimal.
Fields§
§state: Mutex<FastRand>
Internal state for the seed generator. We keep it in a Mutex so that we can safely use it across multiple threads.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RngSeedGenerator
impl RefUnwindSafe for RngSeedGenerator
impl Send for RngSeedGenerator
impl Sync for RngSeedGenerator
impl Unpin for RngSeedGenerator
impl UnwindSafe for RngSeedGenerator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more