Trait linera_witty::Instance

source ·
pub trait Instance: Sized {
    type Runtime: Runtime;
    type UserData;
    type UserDataReference<'a>: Deref<Target = Self::UserData>
       where Self::UserData: 'a,
             Self: 'a;
    type UserDataMutReference<'a>: DerefMut<Target = Self::UserData>
       where Self::UserData: 'a,
             Self: 'a;

    // Required methods
    fn load_export(
        &mut self,
        name: &str,
    ) -> Option<<Self::Runtime as Runtime>::Export>;
    fn user_data(&self) -> Self::UserDataReference<'_>;
    fn user_data_mut(&mut self) -> Self::UserDataMutReference<'_>;
}
Expand description

An active guest Wasm module.

Required Associated Types§

source

type Runtime: Runtime

The runtime this instance is running in.

source

type UserData

Custom user data stored in the instance.

source

type UserDataReference<'a>: Deref<Target = Self::UserData> where Self::UserData: 'a, Self: 'a

A reference to the custom user data stored in the instance.

source

type UserDataMutReference<'a>: DerefMut<Target = Self::UserData> where Self::UserData: 'a, Self: 'a

A mutable reference to the custom user data stored in the instance.

Required Methods§

source

fn load_export( &mut self, name: &str, ) -> Option<<Self::Runtime as Runtime>::Export>

Loads an export from the guest module.

source

fn user_data(&self) -> Self::UserDataReference<'_>

Returns a reference to the custom user data stored in this instance.

source

fn user_data_mut(&mut self) -> Self::UserDataMutReference<'_>

Returns a mutable reference to the custom user data stored in this instance.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<I> Instance for &mut I
where I: Instance,

§

type Runtime = <I as Instance>::Runtime

§

type UserData = <I as Instance>::UserData

§

type UserDataReference<'a> = <I as Instance>::UserDataReference<'a> where Self::UserData: 'a, Self: 'a

§

type UserDataMutReference<'a> = <I as Instance>::UserDataMutReference<'a> where Self::UserData: 'a, Self: 'a

source§

fn load_export( &mut self, name: &str, ) -> Option<<Self::Runtime as Runtime>::Export>

source§

fn user_data(&self) -> Self::UserDataReference<'_>

source§

fn user_data_mut(&mut self) -> Self::UserDataMutReference<'_>

Implementors§

source§

impl<UserData> Instance for MockInstance<UserData>

§

type Runtime = MockRuntime

§

type UserData = UserData

§

type UserDataReference<'a> = MutexGuard<'a, UserData> where Self::UserData: 'a, Self: 'a

§

type UserDataMutReference<'a> = MutexGuard<'a, UserData> where Self::UserData: 'a, Self: 'a

source§

impl<UserData> Instance for linera_witty::wasmer::EntrypointInstance<UserData>

§

type Runtime = Wasmer

§

type UserData = UserData

§

type UserDataReference<'a> = MutexGuard<'a, UserData> where Self::UserData: 'a, Self: 'a

§

type UserDataMutReference<'a> = MutexGuard<'a, UserData> where Self::UserData: 'a, Self: 'a

source§

impl<UserData> Instance for Caller<'_, UserData>

§

type Runtime = Wasmtime

§

type UserData = UserData

§

type UserDataReference<'a> = &'a UserData where Self: 'a, UserData: 'a

§

type UserDataMutReference<'a> = &'a mut UserData where Self: 'a, UserData: 'a

source§

impl<UserData> Instance for linera_witty::wasmtime::EntrypointInstance<UserData>

§

type Runtime = Wasmtime

§

type UserData = UserData

§

type UserDataReference<'a> = &'a UserData where Self: 'a, UserData: 'a

§

type UserDataMutReference<'a> = &'a mut UserData where Self: 'a, UserData: 'a

source§

impl<UserData> Instance for StubInstance<UserData>

§

type Runtime = StubRuntime

§

type UserData = UserData

§

type UserDataReference<'a> = &'a UserData where Self::UserData: 'a, Self: 'a

§

type UserDataMutReference<'a> = &'a mut UserData where Self::UserData: 'a, Self: 'a

source§

impl<UserData: 'static> Instance for ReentrantInstance<'_, UserData>

§

type Runtime = Wasmer

§

type UserData = UserData

§

type UserDataReference<'a> = MutexGuard<'a, UserData> where Self::UserData: 'a, Self: 'a

§

type UserDataMutReference<'a> = MutexGuard<'a, UserData> where Self::UserData: 'a, Self: 'a