[][src]Struct egg::Rewrite

#[non_exhaustive]pub struct Rewrite<L, N> { /* 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.

Implementations

impl<L, N> Rewrite<L, N>[src]

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.

impl<L: Language, N: Analysis<L>> Rewrite<L, N>[src]

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

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

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

Call search on the Searcher.

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

Call apply_matches on the Applier.

Trait Implementations

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

impl<L, N> Debug for Rewrite<L, N> where
    L: Language + 'static,
    N: 'static, 
[src]

Auto Trait Implementations

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

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

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

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

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

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.