pub enum SimplifyResult<Node, NodeId> {
Node(Node, bool),
Simplified(NodeId, bool),
}Expand description
Either a node or a node ID. Used to make node simplification syntactically clean.
Variants§
Node(Node, bool)
Not fully simplified node with an optional inversion of the output.
Simplified(NodeId, bool)
Simplified down to an existing node ID with optional inversion of the output.
Implementations§
Source§impl<N, Id> SimplifyResult<N, Id>
impl<N, Id> SimplifyResult<N, Id>
Sourcepub fn and_then(
self,
f: impl Fn(N) -> SimplifyResult<N, Id>,
) -> SimplifyResult<N, Id>
pub fn and_then( self, f: impl Fn(N) -> SimplifyResult<N, Id>, ) -> SimplifyResult<N, Id>
If the result is not simplified yet, try to simplify the node further using the function f.
Sourcepub fn map_unsimplified(self, f: impl Fn(N) -> N) -> SimplifyResult<N, Id>
pub fn map_unsimplified(self, f: impl Fn(N) -> N) -> SimplifyResult<N, Id>
Apply f to the node if it is not simplified yet.
Sourcepub fn invert_conditional(self, invert: bool) -> Self
pub fn invert_conditional(self, invert: bool) -> Self
Invert the output value iff invert is true.
Auto Trait Implementations§
impl<Node, NodeId> Freeze for SimplifyResult<Node, NodeId>
impl<Node, NodeId> RefUnwindSafe for SimplifyResult<Node, NodeId>where
Node: RefUnwindSafe,
NodeId: RefUnwindSafe,
impl<Node, NodeId> Send for SimplifyResult<Node, NodeId>
impl<Node, NodeId> Sync for SimplifyResult<Node, NodeId>
impl<Node, NodeId> Unpin for SimplifyResult<Node, NodeId>
impl<Node, NodeId> UnwindSafe for SimplifyResult<Node, NodeId>where
Node: UnwindSafe,
NodeId: 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more