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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.