pub trait ExportedFunctionInterface {
type HostParameters: WitType;
type HostResults: WitStore;
type GuestInterface: GuestInterface<FlatHostParameters = <<Self::HostParameters as WitType>::Layout as Layout>::Flat, ResultStorage = Self::ResultStorage>;
type GuestParameters;
type GuestResults;
type ResultStorage: ResultStorage<OutputFor<Self::HostResults> = Self::GuestResults>;
// Required methods
fn lift_parameters<Instance>(
guest_parameters: Self::GuestParameters,
memory: &Memory<'_, Instance>,
) -> Result<(Self::HostParameters, Self::ResultStorage), RuntimeError>
where Instance: InstanceWithMemory,
<Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>;
fn lower_results<Instance>(
results: Self::HostResults,
result_storage: Self::ResultStorage,
memory: &mut Memory<'_, Instance>,
) -> Result<Self::GuestResults, RuntimeError>
where Instance: InstanceWithMemory,
<Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>;
}
Expand description
Representation of an exported host function’s interface.
Implemented for a tuple pair of the host parameters type and the host results type, and allows converting to the signature the guest Wasm instance uses for that host function.
Required Associated Types§
sourcetype HostParameters: WitType
type HostParameters: WitType
The type representing the host-side parameters.
sourcetype HostResults: WitStore
type HostResults: WitStore
The type representing the host-side results.
sourcetype GuestInterface: GuestInterface<FlatHostParameters = <<Self::HostParameters as WitType>::Layout as Layout>::Flat, ResultStorage = Self::ResultStorage>
type GuestInterface: GuestInterface<FlatHostParameters = <<Self::HostParameters as WitType>::Layout as Layout>::Flat, ResultStorage = Self::ResultStorage>
The representation of the guest-side function interface.
sourcetype GuestParameters
type GuestParameters
The type representing the guest-side parameters.
sourcetype GuestResults
type GuestResults
The type representing the guest-side results.
sourcetype ResultStorage: ResultStorage<OutputFor<Self::HostResults> = Self::GuestResults>
type ResultStorage: ResultStorage<OutputFor<Self::HostResults> = Self::GuestResults>
How the results from the exported host function should be sent back to the guest.
Required Methods§
sourcefn lift_parameters<Instance>(
guest_parameters: Self::GuestParameters,
memory: &Memory<'_, Instance>,
) -> Result<(Self::HostParameters, Self::ResultStorage), RuntimeError>where
Instance: InstanceWithMemory,
<Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,
fn lift_parameters<Instance>(
guest_parameters: Self::GuestParameters,
memory: &Memory<'_, Instance>,
) -> Result<(Self::HostParameters, Self::ResultStorage), RuntimeError>where
Instance: InstanceWithMemory,
<Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,
Converts the guest-side parameters into the host-side parameters.
sourcefn lower_results<Instance>(
results: Self::HostResults,
result_storage: Self::ResultStorage,
memory: &mut Memory<'_, Instance>,
) -> Result<Self::GuestResults, RuntimeError>where
Instance: InstanceWithMemory,
<Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,
fn lower_results<Instance>(
results: Self::HostResults,
result_storage: Self::ResultStorage,
memory: &mut Memory<'_, Instance>,
) -> Result<Self::GuestResults, RuntimeError>where
Instance: InstanceWithMemory,
<Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,
Converts the host-side results into the guest-side results.
Object Safety§
This trait is not object safe.