SimplifyResult

Enum SimplifyResult 

Source
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>

Source

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.

Source

pub fn map_unsimplified(self, f: impl Fn(N) -> N) -> SimplifyResult<N, Id>

Apply f to the node if it is not simplified yet.

Source

pub fn new_node(node: N) -> Self

Create from a node.

Source

pub fn new_id(id: Id) -> Self

Create from a node ID.

Source

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>
where Node: Freeze, NodeId: Freeze,

§

impl<Node, NodeId> RefUnwindSafe for SimplifyResult<Node, NodeId>
where Node: RefUnwindSafe, NodeId: RefUnwindSafe,

§

impl<Node, NodeId> Send for SimplifyResult<Node, NodeId>
where Node: Send, NodeId: Send,

§

impl<Node, NodeId> Sync for SimplifyResult<Node, NodeId>
where Node: Sync, NodeId: Sync,

§

impl<Node, NodeId> Unpin for SimplifyResult<Node, NodeId>
where Node: Unpin, NodeId: Unpin,

§

impl<Node, NodeId> UnwindSafe for SimplifyResult<Node, NodeId>
where Node: UnwindSafe, NodeId: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.