[][src]Struct proptest::strategy::LazyJust

#[must_use = "strategies do nothing unless used"]
pub struct LazyJust<T, F: Fn() -> T> { /* fields omitted */ }

A Strategy which always produces a single value value and never simplifies. If T is Clone, you should use Just instead.

This is a generalization of Just and works by calling the provided Fn () -> T in .current() every time. This is not a very interesting strategy, but is required in cases where T is not Clone. It is also used in proptest_derive where we can't assume that your type is Clone.

It is important that the function used be pure.

Methods

impl<T, F: Fn() -> T> LazyJust<T, F>[src]

pub fn new(function: F) -> Self[src]

Constructs a LazyJust strategy given the function/closure that produces the value.

It is important that the function used be pure.

Trait Implementations

impl<T, F: Clone + Fn() -> T> Clone for LazyJust<T, F>[src]

impl<T, F: Copy + Fn() -> T> Copy for LazyJust<T, F>[src]

impl<T, F: Fn() -> T> Debug for LazyJust<T, F>[src]

impl<T: Debug, F: Clone + Fn() -> T> Strategy for LazyJust<T, F>[src]

type Tree = Self

The value tree generated by this Strategy.

type Value = T

The type of value used by functions under test generated by this Strategy. Read more

impl<T: Debug, F: Fn() -> T> ValueTree for LazyJust<T, F>[src]

type Value = T

The type of the value produced by this ValueTree.

Auto Trait Implementations

impl<T, F> RefUnwindSafe for LazyJust<T, F> where
    F: RefUnwindSafe

impl<T, F> Send for LazyJust<T, F> where
    F: Send

impl<T, F> Sync for LazyJust<T, F> where
    F: Sync

impl<T, F> Unpin for LazyJust<T, F> where
    F: Unpin

impl<T, F> UnwindSafe for LazyJust<T, F> where
    F: UnwindSafe

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>,