pub enum Decision<P> {
IsTrue(P),
IsFalse(String),
}Expand description
A decision about a proposition P.
Decision::IsTrue carries a witness (proof) that P holds.
Decision::IsFalse carries an explanation that it does not.
Variants§
IsTrue(P)
The proposition holds.
IsFalse(String)
The proposition does not hold; the string is an explanatory message.
Implementations§
Source§impl<P> Decision<P>
impl<P> Decision<P>
Sourcepub fn into_option(self) -> Option<P>
pub fn into_option(self) -> Option<P>
Convert to Option, dropping the negative message.
Sourcepub fn and<Q>(self, other: Decision<Q>) -> Decision<(P, Q)>
pub fn and<Q>(self, other: Decision<Q>) -> Decision<(P, Q)>
Combine with another Decision via conjunction.
Sourcepub fn or(self, other: Decision<P>) -> Decision<P>
pub fn or(self, other: Decision<P>) -> Decision<P>
Combine with another Decision via disjunction (left-biased).
Sourcepub fn flat_map<Q>(self, f: impl FnOnce(P) -> Decision<Q>) -> Decision<Q>
pub fn flat_map<Q>(self, f: impl FnOnce(P) -> Decision<Q>) -> Decision<Q>
Apply f if true, returning a new decision.
Sourcepub fn unwrap_or_else(self, f: impl FnOnce(String) -> P) -> P
pub fn unwrap_or_else(self, f: impl FnOnce(String) -> P) -> P
Apply a fallback function if false.
Trait Implementations§
impl<P: Eq> Eq for Decision<P>
impl<P> StructuralPartialEq for Decision<P>
Auto Trait Implementations§
impl<P> Freeze for Decision<P>where
P: Freeze,
impl<P> RefUnwindSafe for Decision<P>where
P: RefUnwindSafe,
impl<P> Send for Decision<P>where
P: Send,
impl<P> Sync for Decision<P>where
P: Sync,
impl<P> Unpin for Decision<P>where
P: Unpin,
impl<P> UnsafeUnpin for Decision<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for Decision<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more