[][src]Struct libra_proptest_helpers::ValueGenerator

pub struct ValueGenerator { /* fields omitted */ }

Context for generating single values out of strategies.

Proptest is designed to be built around "value trees", which represent a spectrum from complex values to simpler ones. But in some contexts, like benchmarking or generating corpuses, one just wants a single value. This is a convenience struct for that.

Implementations

impl ValueGenerator[src]

pub fn new() -> Self[src]

Creates a new value generator with the default RNG.

pub fn new_with_rng(rng: TestRng) -> Self[src]

Creates a new value generator with provided RNG

pub fn deterministic() -> Self[src]

Creates a new value generator with a deterministic RNG.

This generator has a hardcoded seed, so its results are predictable across test runs. However, a new proptest version may change the seed.

pub fn generate<S: Strategy>(&mut self, strategy: S) -> S::Value[src]

Generates a single value for this strategy.

Panics if generating the new value fails. The only situation in which this can happen is if generating the value causes too many internal rejects.

Trait Implementations

impl Default for ValueGenerator[src]

Auto Trait Implementations

impl !RefUnwindSafe for ValueGenerator

impl Send for ValueGenerator

impl Sync for ValueGenerator

impl Unpin for ValueGenerator

impl !UnwindSafe for ValueGenerator

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,