Struct futures_ringbuf::Dictator
source · pub struct Dictator { /* private fields */ }
Expand description
Dictator that makes random decisions based on a seed. That is the decisions are reproducible. For reproducible decisions, your use of the dictator must be deterministic.
Implementations§
source§impl Dictator
impl Dictator
sourcepub fn new(seed: u64) -> Self
pub fn new(seed: u64) -> Self
Birth place of all dictators. This method will log the seed with log::trace. Make sure you turn on logging for the futures_ringbuf crate so you can reproduce failing tests.
sourcepub fn please(&mut self, question: &str, prob: f64) -> bool
pub fn please(&mut self, question: &str, prob: f64) -> bool
Ask the dictator permission to do something.
sourcepub fn pick<Idx: SampleUniform + Debug + Copy + PartialOrd>(
&mut self,
what: &str,
range: Range<Idx>
) -> Idx
pub fn pick<Idx: SampleUniform + Debug + Copy + PartialOrd>( &mut self, what: &str, range: Range<Idx> ) -> Idx
Ask the dictator to pick from a range of values.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Dictator
impl Send for Dictator
impl Sync for Dictator
impl Unpin for Dictator
impl UnwindSafe for Dictator
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