Trait egg::LanguageMapper

source ·
pub trait LanguageMapper<L, A>
where L: Language, A: Analysis<L>,
{ type L2: Language; type A2: Analysis<Self::L2>; // Required methods fn map_node(&self, node: L) -> Self::L2; fn map_discriminant( &self, discriminant: L::Discriminant ) -> <Self::L2 as Language>::Discriminant; fn map_analysis(&self, analysis: A) -> Self::A2; fn map_data(&self, data: A::Data) -> <Self::A2 as Analysis<Self::L2>>::Data; // Provided methods fn map_eclass( &self, src_eclass: EClass<L, A::Data> ) -> EClass<Self::L2, <Self::A2 as Analysis<Self::L2>>::Data> { ... } fn map_egraph(&self, src_egraph: EGraph<L, A>) -> EGraph<Self::L2, Self::A2> { ... } }
Expand description

Translates EGraph<L, A> into EGraph<L2, A2>. For common cases, you don’t need to implement this manually. See the provided SimpleLanguageMapper.

Required Associated Types§

source

type L2: Language

The target language to translate into.

source

type A2: Analysis<Self::L2>

The target analysis to transate into.

Required Methods§

source

fn map_node(&self, node: L) -> Self::L2

Translate a node of L into a node of L2.

source

fn map_discriminant( &self, discriminant: L::Discriminant ) -> <Self::L2 as Language>::Discriminant

Translate L::Discriminant into L2::Discriminant

source

fn map_analysis(&self, analysis: A) -> Self::A2

Translate an analysis of type A into an analysis of A2.

source

fn map_data(&self, data: A::Data) -> <Self::A2 as Analysis<Self::L2>>::Data

Translate A::Data into A2::Data.

Provided Methods§

source

fn map_eclass( &self, src_eclass: EClass<L, A::Data> ) -> EClass<Self::L2, <Self::A2 as Analysis<Self::L2>>::Data>

Translate an EClass over L into an EClass over L2.

source

fn map_egraph(&self, src_egraph: EGraph<L, A>) -> EGraph<Self::L2, Self::A2>

Map an EGraph over L into an EGraph over L2.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<L, A, L2, A2> LanguageMapper<L, A> for SimpleLanguageMapper<L2, A2>
where L: Language, A: Analysis<L>, L2: Language + From<L>, A2: Analysis<L2> + From<A>, <L2 as Language>::Discriminant: From<<L as Language>::Discriminant>, <A2 as Analysis<L2>>::Data: From<<A as Analysis<L>>::Data>,

§

type L2 = L2

§

type A2 = A2