pub trait Primitive {
// Required methods
fn name(&self) -> &str;
fn get_type_constraints(&self, span: &Span) -> Box<dyn TypeConstraint>;
fn apply(
&self,
exec_state: &mut ExecutionState<'_>,
args: &[Value],
) -> Option<Value>;
}Expand description
A trait for implementing custom primitive operations in egglog.
Primitives are built-in functions that can be called in both rule queries and actions.
Required Methods§
Sourcefn get_type_constraints(&self, span: &Span) -> Box<dyn TypeConstraint>
fn get_type_constraints(&self, span: &Span) -> Box<dyn TypeConstraint>
Constructs a type constraint for the primitive that uses the span information for error localization.