Trait linera_witty::InstanceWithFunction
source · pub trait InstanceWithFunction<Parameters, Results>: Instancewhere
Parameters: FlatLayout,
Results: FlatLayout,{
type Function;
// Required methods
fn function_from_export(
&mut self,
export: <Self::Runtime as Runtime>::Export,
) -> Result<Option<Self::Function>, RuntimeError>;
fn call(
&mut self,
function: &Self::Function,
parameters: Parameters,
) -> Result<Results, RuntimeError>;
// Provided method
fn load_function(
&mut self,
name: &str,
) -> Result<Self::Function, RuntimeError> { ... }
}
Expand description
How a runtime supports a function signature.
Required Associated Types§
Required Methods§
sourcefn function_from_export(
&mut self,
export: <Self::Runtime as Runtime>::Export,
) -> Result<Option<Self::Function>, RuntimeError>
fn function_from_export( &mut self, export: <Self::Runtime as Runtime>::Export, ) -> Result<Option<Self::Function>, RuntimeError>
Converts an export into a function, if it is one.
sourcefn call(
&mut self,
function: &Self::Function,
parameters: Parameters,
) -> Result<Results, RuntimeError>
fn call( &mut self, function: &Self::Function, parameters: Parameters, ) -> Result<Results, RuntimeError>
Calls the function
from this instance using the specified parameters
.
Provided Methods§
sourcefn load_function(&mut self, name: &str) -> Result<Self::Function, RuntimeError>
fn load_function(&mut self, name: &str) -> Result<Self::Function, RuntimeError>
Loads a function from the guest Wasm instance.
Object Safety§
This trait is not object safe.