pub struct RngSeed(/* private fields */);Expand description
A seed for a runtime’s random choices: where a task spawned from outside
its workers goes, and which branch of a fair
select! is polled first.
A runtime built with Builder::rng_seed
seeds each of its workers, and each thread in its block_on, from the
seed: run after run, such a thread draws the same numbers, so its
choices repeat as long as what it chooses among is the same. The threads
still interleave as the system runs them.
use nuclei::runtime::{RngSeed, Runtime};
let seed = RngSeed::from_bytes(b"a run to repeat");
assert_eq!(seed, RngSeed::from_bytes(b"a run to repeat"));
let rt = Runtime::builder().rng_seed(seed).build().unwrap();Implementations§
Trait Implementations§
impl Copy for RngSeed
impl Eq for RngSeed
impl StructuralPartialEq for RngSeed
Auto Trait Implementations§
impl Freeze for RngSeed
impl RefUnwindSafe for RngSeed
impl Send for RngSeed
impl Sync for RngSeed
impl Unpin for RngSeed
impl UnsafeUnpin for RngSeed
impl UnwindSafe for RngSeed
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