Struct tinyrand_alloc::mock::Surrogate
source · [−]pub struct Surrogate<'a, 'd> { /* private fields */ }
Expand description
Encapsulates the state of the mock and a reference to the next_u128
delegate, so
that it can be invoked from inside the mock by, for example, another delegate.
Implementations
Trait Implementations
sourceimpl<'a, 'd> Rand for Surrogate<'a, 'd>
impl<'a, 'd> Rand for Surrogate<'a, 'd>
sourcefn next_usize(&mut self) -> usize
fn next_usize(&mut self) -> usize
Returns the next random usize
.
sourcefn next_bool(&mut self, p: Probability) -> bool
fn next_bool(&mut self, p: Probability) -> bool
Returns a bool
with a probability p
of being true. Read more
sourcefn next_lim_u16(&mut self, lim: u16) -> u16
fn next_lim_u16(&mut self, lim: u16) -> u16
Generates a random number in 0..lim
.
sourcefn next_lim_u32(&mut self, lim: u32) -> u32
fn next_lim_u32(&mut self, lim: u32) -> u32
Generates a random number in 0..lim
.
sourcefn next_lim_u64(&mut self, lim: u64) -> u64
fn next_lim_u64(&mut self, lim: u64) -> u64
Generates a random number in 0..lim
.
sourcefn next_lim_u128(&mut self, lim: u128) -> u128
fn next_lim_u128(&mut self, lim: u128) -> u128
Generates a random number in 0..lim
.
sourcefn next_lim_usize(&mut self, lim: usize) -> usize
fn next_lim_usize(&mut self, lim: usize) -> usize
Generates a random number in 0..lim
.
Auto Trait Implementations
impl<'a, 'd> !RefUnwindSafe for Surrogate<'a, 'd>
impl<'a, 'd> !Send for Surrogate<'a, 'd>
impl<'a, 'd> !Sync for Surrogate<'a, 'd>
impl<'a, 'd> Unpin for Surrogate<'a, 'd>where
'd: 'a,
impl<'a, 'd> !UnwindSafe for Surrogate<'a, 'd>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<R> RandRange<Duration> for Rwhere
R: Rand,
impl<R> RandRange<Duration> for Rwhere
R: Rand,
sourcefn next_range(&mut self, range: Range<Duration>) -> Duration
fn next_range(&mut self, range: Range<Duration>) -> Duration
Generates a random number in the given range.
sourceimpl<R> RandRange<u128> for Rwhere
R: Rand,
impl<R> RandRange<u128> for Rwhere
R: Rand,
sourcefn next_range(&mut self, range: Range<u128>) -> u128
fn next_range(&mut self, range: Range<u128>) -> u128
Generates a random number in the given range.
sourceimpl<R> RandRange<u16> for Rwhere
R: Rand,
impl<R> RandRange<u16> for Rwhere
R: Rand,
sourcefn next_range(&mut self, range: Range<u16>) -> u16
fn next_range(&mut self, range: Range<u16>) -> u16
Generates a random number in the given range.
sourceimpl<R> RandRange<u32> for Rwhere
R: Rand,
impl<R> RandRange<u32> for Rwhere
R: Rand,
sourcefn next_range(&mut self, range: Range<u32>) -> u32
fn next_range(&mut self, range: Range<u32>) -> u32
Generates a random number in the given range.
sourceimpl<R> RandRange<u64> for Rwhere
R: Rand,
impl<R> RandRange<u64> for Rwhere
R: Rand,
sourcefn next_range(&mut self, range: Range<u64>) -> u64
fn next_range(&mut self, range: Range<u64>) -> u64
Generates a random number in the given range.
sourceimpl<R> RandRange<usize> for Rwhere
R: Rand,
impl<R> RandRange<usize> for Rwhere
R: Rand,
sourcefn next_range(&mut self, range: Range<usize>) -> usize
fn next_range(&mut self, range: Range<usize>) -> usize
Generates a random number in the given range.