pub trait ScriptExpression: Send + Sync {
// Required method
fn evaluate(&self, context: &mut Context, registry: &Registry);
}Expand description
The extra operations a frontend adds on top of the built-in set.
The built-in operations move data around but never create it, since the platform has no opinion about what data is. Pushing a literal, dropping a value, anything else specific to one language, goes here.
enum MyExpression {
Literal(i32),
Drop,
}
impl ScriptExpression for MyExpression {
fn evaluate(&self, context: &mut Context, _: &Registry) {
match self {
Self::Literal(value) => { context.stack().push(*value); }
Self::Drop => { context.stack().drop(); }
}
}
}Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".