Struct prae::Guarded [−][src]
pub struct Guarded<T, E, G: Guard<Target = T, Error = E>>(_, _, _);
Expand description
A thin wrapper around an underlying type and a Guard
bounded to it. It guarantees
to always hold specified invariants and act as close as possible to the underlying type.
Implementations
Constructor. Will return an error if the provided argument v
doesn’t pass the validation.
Mutates current value using provided closure. Will panic if the result of the mutation is invalid.
Trait Implementations
impl<T: PartialOrd, E, G: Guard<Target = T, Error = E>> PartialOrd<Guarded<T, E, G>> for Guarded<T, E, G>
impl<T: PartialOrd, E, G: Guard<Target = T, Error = E>> PartialOrd<Guarded<T, E, G>> for Guarded<T, E, G>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T, E, G> RefUnwindSafe for Guarded<T, E, G> where
E: RefUnwindSafe,
G: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, E, G> UnwindSafe for Guarded<T, E, G> where
E: UnwindSafe,
G: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more