[][src]Struct egg::Rewrite

#[non_exhaustive]
pub struct Rewrite<L, M> { /* fields omitted */ }

A rewrite that searches for the lefthand side and applies the righthand side.

The rewrite! is the easiest way to create rewrites.

A Rewrite consists principally of a Searcher (the lefthand side) and an Applier (the righthand side). It additionally stores a name used to refer to the rewrite and a long name used for debugging.

Methods

impl<L: Language, M: Metadata<L>> Rewrite<L, M>[src]

pub fn new(
    name: impl Into<String>,
    long_name: impl Into<String>,
    searcher: impl Searcher<L, M> + 'static,
    applier: impl Applier<L, M> + 'static
) -> Self
[src]

Create a new Rewrite. You typically want to use the rewrite! macro instead.

pub fn name(&self) -> &str[src]

Returns the name of the rewrite.

pub fn long_name(&self) -> &str[src]

Returns the long name of the rewrite which should only be used for debugging and displaying.

pub fn search(&self, egraph: &EGraph<L, M>) -> Vec<SearchMatches>[src]

Call search on the Searcher.

pub fn apply(
    &self,
    egraph: &mut EGraph<L, M>,
    matches: &[SearchMatches]
) -> Vec<Id>
[src]

Call apply_matches on the Applier.

Trait Implementations

impl<L: Clone, M: Clone> Clone for Rewrite<L, M>[src]

Auto Trait Implementations

impl<L, M> !RefUnwindSafe for Rewrite<L, M>

impl<L, M> !Send for Rewrite<L, M>

impl<L, M> !Sync for Rewrite<L, M>

impl<L, M> Unpin for Rewrite<L, M>

impl<L, M> !UnwindSafe for Rewrite<L, M>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.