Struct LazyJust

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

A Strategy which always produces a single 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.

Implementations

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

fn new(function: F) -> Self

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>

fn clone(&self) -> Self

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

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

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

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

type Tree = LazyJust<T, F>;
type Value = T;
fn new_tree(&self, &mut TestRunner) -> NewTree<Self>

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

type Value = T;
fn simplify(&mut self) -> bool
fn complicate(&mut self) -> bool
fn current(&self) -> Self::Value

Auto Trait Implementations

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

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> UnsafeUnpin for LazyJust<T, F> where F: UnsafeUnpin,

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

Blanket Implementations

impl<T> Any for LazyJust<T, F> where T: 'static + ?Sized,

impl<T> Borrow<T> for LazyJust<T, F> where T: ?Sized,

impl<T> BorrowMut<T> for LazyJust<T, F> where T: ?Sized,

impl<T> CloneToUninit for LazyJust<T, F> where T: Clone,

impl<T> From<T> for LazyJust<T, F>

impl<T> ToOwned for LazyJust<T, F> where T: Clone,

impl<T, U> Into<U> for LazyJust<T, F> where U: From<T>,

impl<T, U> TryFrom<U> for LazyJust<T, F> where U: Into<T>,

impl<T, U> TryInto<U> for LazyJust<T, F> where U: TryFrom<T>,