NopModule

Struct NopModule 

Source
pub struct NopModule;
Expand description

A no-operation WASM module.

Any call will return an error.

Trait Implementations§

Source§

impl Linker<NopModule> for NopLinker

Source§

fn new() -> Result<Self>

Create the linker.
Source§

fn create(&self, _binary: &[u8]) -> Result<NopModule>

Create a raw module from binary.
Source§

fn import( &mut self, _ns: impl Into<String>, _funcs: HashMap<String, ()>, ) -> Result<()>

Import functions by namespace and names.
Source§

fn wrap_raw( &self, _f: impl Fn(Self, i32, i32) -> Result<Vec<u8>> + Send + Sync + 'static, )

Wrap a function with args in bytes.
Source§

fn wrap<P, R>( &self, f: impl Fn(P) -> Result<R, Error> + Send + Sync + 'static, ) -> <M as RawModule>::Func

Wrap a function with args.
Source§

fn wrap_with<P, R>( &self, f: impl Fn(<M as RawModule>::LinkerHandle<'_>, P) -> Result<R, Error> + Send + Sync + 'static, ) -> <M as RawModule>::Func

Wrap a function with args and linker handle.
Source§

impl<'a> LinkerHandle<'a, NopModule> for NopLinker

Source§

fn call<T>( &mut self, _m: &NopModule, name: &str, _args: &[u8], _f: impl FnOnce(&[u8]) -> Result<T>, ) -> Result<T>

Call methods of a module.
Source§

fn slice<T>(&self, _start: i32, _len: i32, _f: impl FnOnce(&[u8]) -> T) -> T

Get memory slice.
Source§

fn slice_mut<T>( &mut self, _start: i32, _len: i32, _f: impl FnOnce(&mut [u8]) -> T, ) -> T

Get memory mutable slice.
Source§

impl RawModule for NopModule

Source§

type Linker = NopLinker

The linker type that can create raw module.
Source§

type LinkerHandle<'a> = NopLinker

The linker handle type.
Source§

type Func = ()

The import function type.
Source§

fn call<T>( &self, name: &str, _args: &[u8], _f: impl FnOnce(&[u8]) -> Result<T>, ) -> Result<T>

Calls a method by name. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.