Trait Sort

Source
pub trait Sort:
    Any
    + Send
    + Sync
    + Debug {
Show 14 methods // Required methods fn name(&self) -> &str; fn column_ty(&self, backend: &EGraph) -> ColumnTy; fn register_type(&self, backend: &mut EGraph); fn as_arc_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync + 'static>; fn value_type(&self) -> Option<TypeId>; // Provided methods fn inner_sorts(&self) -> Vec<ArcSort> { ... } fn is_eq_sort(&self) -> bool { ... } fn is_container_sort(&self) -> bool { ... } fn is_eq_container_sort(&self) -> bool { ... } fn serialized_name( &self, _container_values: &ContainerValues, _value: Value, ) -> String { ... } fn inner_values( &self, container_values: &ContainerValues, value: Value, ) -> Vec<(ArcSort, Value)> { ... } fn register_primitives(self: Arc<Self>, eg: &mut EGraph) { ... } fn reconstruct_termdag_container( &self, container_values: &ContainerValues, value: Value, termdag: &mut TermDag, element_terms: Vec<Term>, ) -> Term { ... } fn reconstruct_termdag_base( &self, base_values: &BaseValues, value: Value, termdag: &mut TermDag, ) -> Term { ... }
}
Expand description

A sort (type) in the e-graph that defines values in egglog. Sorts are user-extensible (e.g., prelude::BaseSort).

Required Methods§

Source

fn name(&self) -> &str

Returns the name of this sort.

Source

fn column_ty(&self, backend: &EGraph) -> ColumnTy

Returns the backend-specific column type. See ColumnTy.

Source

fn register_type(&self, backend: &mut EGraph)

Source

fn as_arc_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync + 'static>

Source

fn value_type(&self) -> Option<TypeId>

Return the type id of values that this sort represents.

Every non-EqSort sort should return Some(TypeId).

Provided Methods§

Source

fn inner_sorts(&self) -> Vec<ArcSort>

return the inner sorts if a container sort remember that containers can contain containers and this only unfolds one level

Source

fn is_eq_sort(&self) -> bool

Source

fn is_container_sort(&self) -> bool

Source

fn is_eq_container_sort(&self) -> bool

Source

fn serialized_name( &self, _container_values: &ContainerValues, _value: Value, ) -> String

Return the serialized name of the sort

Only used for container sorts, which cannot be serialized with make_expr so need an explicit name

Source

fn inner_values( &self, container_values: &ContainerValues, value: Value, ) -> Vec<(ArcSort, Value)>

Return the inner values and sorts. Only container sort need to implement this method,

Source

fn register_primitives(self: Arc<Self>, eg: &mut EGraph)

Source

fn reconstruct_termdag_container( &self, container_values: &ContainerValues, value: Value, termdag: &mut TermDag, element_terms: Vec<Term>, ) -> Term

Reconstruct a container value in a TermDag

Source

fn reconstruct_termdag_base( &self, base_values: &BaseValues, value: Value, termdag: &mut TermDag, ) -> Term

Reconstruct a leaf primitive value in a TermDag

Implementors§