pub trait ScriptFunctionGenerator<SE: ScriptExpression> {
type Input;
type Output;
// Required method
fn generate_function_body(
script: ScriptHandle<'static, SE>,
input: Self::Input,
) -> Option<(FunctionBody, Self::Output)>;
// Provided method
fn generate_function(
function: &ScriptFunction<'static, SE>,
registry: &Registry,
input: Self::Input,
) -> Option<(Function, Self::Output)> { ... }
}Expand description
A backend: turns script operations into a runnable function body.
A virtual machine implements this by keeping the operations and stepping
through them. A transpiler could emit code instead. Input is whatever the
backend needs to be given, Output whatever it wants to hand back.
Required Associated Types§
Required Methods§
Sourcefn generate_function_body(
script: ScriptHandle<'static, SE>,
input: Self::Input,
) -> Option<(FunctionBody, Self::Output)>
fn generate_function_body( script: ScriptHandle<'static, SE>, input: Self::Input, ) -> Option<(FunctionBody, Self::Output)>
Builds a body from a script, or returns None when it cannot.
Provided Methods§
Sourcefn generate_function(
function: &ScriptFunction<'static, SE>,
registry: &Registry,
input: Self::Input,
) -> Option<(Function, Self::Output)>
fn generate_function( function: &ScriptFunction<'static, SE>, registry: &Registry, input: Self::Input, ) -> Option<(Function, Self::Output)>
Builds a whole function, resolving the signature against the registry.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".