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) -> SelfConstructs a
LazyJuststrategy 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) -> boolfn complicate(&mut self) -> boolfn 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for LazyJust<T, F>
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for LazyJust<T, F>
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for LazyJust<T, F>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for LazyJust<T, F>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for LazyJust<T, F>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for LazyJust<T, F>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for LazyJust<T, F>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Read<Exclusive, BecauseExclusive> for LazyJust<T, F>
where
T: ?Sized,
impl<T> ToOwned for LazyJust<T, F>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for LazyJust<T, F>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for LazyJust<T, F>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for LazyJust<T, F>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip<V> for LazyJust<T, F>
where
V: MultiLane<T>,
fn vzip(self) -> V