Struct prae::Guarded [−][src]
pub struct Guarded<G: Guard>(_);
Expand description
A thin wrapper around the underlying type and the 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.
Mutates current value using provided closure. Will return an error if the result of the mutation is invalid.
Retrieve the inner, unprotected value.
Construct a value without calling adjust
and validate
. The invariant must be upheld
manually. Should be used only for optimisation purposes.
Mutate a value without calling adjust
and validate
. The invariant must be upheld
manually. Should be used only for optimisation purposes.
Gives mutable access to the internals without upholding invariants. They must continue to be upheld manually while the reference lives!
Trait Implementations
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<G> RefUnwindSafe for Guarded<G> where
<G as Guard>::Target: RefUnwindSafe,
impl<G> UnwindSafe for Guarded<G> where
<G as Guard>::Target: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more