Skip to main content

Imports

Struct Imports 

Source
pub struct Imports { /* private fields */ }
Expand description

Entities provided by the host to satisfy a module’s state imports (memories, globals, tables), resolved eagerly at instantiation. Function imports resolve separately and lazily via Store::register_host_func.

Implementations§

Source§

impl Imports

Source

pub fn new() -> Self

An empty import set.

Source

pub fn memory(self, module: &str, name: &str, ty: MemType) -> Self

Provide an imported memory (module, name) (fresh allocation).

Source

pub fn shared_memory( self, module: &str, name: &str, ty: MemType, shared: Rc<RefCell<Vec<u8>>>, ) -> Self

Provide an imported memory (module, name) linked from another module’s exports (shared handle).

Source

pub fn global( self, module: &str, name: &str, ty: GlobalType, value: Value, ) -> Self

Provide an imported global (module, name) with its value.

Source

pub fn shared_global( self, module: &str, name: &str, ty: GlobalType, shared: Rc<Cell<Value>>, ) -> Self

Provide an imported global (module, name) linked from another module’s exports (shared cell).

Source

pub fn table(self, module: &str, name: &str, ty: TableType) -> Self

Provide an imported table (module, name) (fresh allocation).

Source

pub fn shared_table( self, module: &str, name: &str, ty: TableType, shared: Rc<RefCell<Table>>, ) -> Self

Provide an imported table (module, name) linked from another module’s exports (shared handle).

Trait Implementations§

Source§

impl Debug for Imports

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Imports

Source§

fn default() -> Imports

Returns the “default value” for a type. 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.