Trait linera_witty::ImportedFunctionInterface

source ·
pub trait ImportedFunctionInterface {
    type HostParameters: WitStore;
    type HostResults: WitLoad;
    type GuestParameters: FlatLayout;
    type GuestResults: FlatLayout;

    // Required methods
    fn lower_parameters<Instance>(
        parameters: Self::HostParameters,
        memory: &mut Memory<'_, Instance>,
    ) -> Result<Self::GuestParameters, RuntimeError>
       where Instance: InstanceWithMemory,
             <Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>;
    fn lift_results<Instance>(
        results: Self::GuestResults,
        memory: &Memory<'_, Instance>,
    ) -> Result<Self::HostResults, RuntimeError>
       where Instance: InstanceWithMemory,
             <Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>;
}
Expand description

Representation of an imported function’s interface.

Implemented for a tuple pair of the host parameters type and the host results type, and then allows converting to the guest function’s signature.

Required Associated Types§

source

type HostParameters: WitStore

The type representing the host-side parameters.

source

type HostResults: WitLoad

The type representing the host-side results.

source

type GuestParameters: FlatLayout

The flat layout representing the guest-side parameters.

source

type GuestResults: FlatLayout

The flat layout representing the guest-side results.

Required Methods§

source

fn lower_parameters<Instance>( parameters: Self::HostParameters, memory: &mut Memory<'_, Instance>, ) -> Result<Self::GuestParameters, RuntimeError>
where Instance: InstanceWithMemory, <Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,

Converts the host-side parameters into the guest-side parameters.

source

fn lift_results<Instance>( results: Self::GuestResults, memory: &Memory<'_, Instance>, ) -> Result<Self::HostResults, RuntimeError>
where Instance: InstanceWithMemory, <Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,

Converts the guest-side results into the host-side results.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<Parameters, Results> ImportedFunctionInterface for (Parameters, Results)
where Parameters: WitStore, Results: WitLoad, <Parameters::Layout as Layout>::Flat: FlatHostParameters, <Results::Layout as Layout>::Flat: FlatHostResults,

§

type HostParameters = Parameters

§

type HostResults = Results

§

type GuestParameters = <<<Parameters as WitType>::Layout as Layout>::Flat as FlatHostParameters>::GuestParameters

§

type GuestResults = <<<Results as WitType>::Layout as Layout>::Flat as FlatHostResults>::GuestResults

source§

fn lower_parameters<Instance>( parameters: Self::HostParameters, memory: &mut Memory<'_, Instance>, ) -> Result<Self::GuestParameters, RuntimeError>
where Instance: InstanceWithMemory, <Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,

source§

fn lift_results<Instance>( results: Self::GuestResults, memory: &Memory<'_, Instance>, ) -> Result<Self::HostResults, RuntimeError>
where Instance: InstanceWithMemory, <Instance::Runtime as Runtime>::Memory: RuntimeMemory<Instance>,

Implementors§