pub trait ExprVisitor {
type ExprId: Copy;
// Required methods
fn add_const_bool(&mut self, ty: TypeId, val: bool) -> Self::ExprId;
fn add_const_int(&mut self, ty: TypeId, val: i128) -> Self::ExprId;
fn add_const_prim(&mut self, ty: TypeId, val: Sym) -> Self::ExprId;
fn add_create_variant(
&mut self,
inputs: Vec<(Self::ExprId, TypeId)>,
ty: TypeId,
variant: VariantId,
) -> Self::ExprId;
fn add_create_struct(
&mut self,
inputs: Vec<(Self::ExprId, TypeId)>,
ty: TypeId,
) -> Self::ExprId;
fn add_construct(
&mut self,
inputs: Vec<(Self::ExprId, TypeId)>,
ty: TypeId,
term: TermId,
pure: bool,
infallible: bool,
multi: bool,
rec: bool,
) -> Self::ExprId;
}Expand description
Visitor interface for Exprs. Visitors can return an arbitrary identifier for each subexpression, which is threaded through to subsequent calls into the visitor.
Required Associated Types§
Required Methods§
Sourcefn add_const_bool(&mut self, ty: TypeId, val: bool) -> Self::ExprId
fn add_const_bool(&mut self, ty: TypeId, val: bool) -> Self::ExprId
Construct a constant boolean.
Sourcefn add_const_int(&mut self, ty: TypeId, val: i128) -> Self::ExprId
fn add_const_int(&mut self, ty: TypeId, val: i128) -> Self::ExprId
Construct a constant integer.
Sourcefn add_const_prim(&mut self, ty: TypeId, val: Sym) -> Self::ExprId
fn add_const_prim(&mut self, ty: TypeId, val: Sym) -> Self::ExprId
Construct a primitive constant.
Sourcefn add_create_variant(
&mut self,
inputs: Vec<(Self::ExprId, TypeId)>,
ty: TypeId,
variant: VariantId,
) -> Self::ExprId
fn add_create_variant( &mut self, inputs: Vec<(Self::ExprId, TypeId)>, ty: TypeId, variant: VariantId, ) -> Self::ExprId
Construct an enum variant with the given inputs assigned to the variant’s fields in order.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".