Extern

Enum Extern 

Source
pub enum Extern<E: WasmEngine> {
    Global(E::Global),
    Table(E::Table),
    Memory(E::Memory),
    Func(E::Func),
}
Expand description

An external item to a WebAssembly module.

This is returned from Instance::exports or Instance::get_export.

Variants§

§

Global(E::Global)

A WebAssembly global which acts like a Cell<T> of sorts, supporting get and set operations.

§

Table(E::Table)

A WebAssembly table which is an array of funtion references.

§

Memory(E::Memory)

A WebAssembly linear memory.

§

Func(E::Func)

A WebAssembly function which can be called.

Implementations§

Source§

impl<E: WasmEngine> Extern<E>

Source

pub fn into_global(self) -> Option<E::Global>

Returns the underlying global variable if self is a global variable.

Returns None otherwise.

Source

pub fn into_table(self) -> Option<E::Table>

Returns the underlying table if self is a table.

Returns None otherwise.

Source

pub fn into_memory(self) -> Option<E::Memory>

Returns the underlying linear memory if self is a linear memory.

Returns None otherwise.

Source

pub fn into_func(self) -> Option<E::Func>

Returns the underlying function if self is a function.

Returns None otherwise.

Source

pub fn ty(&self, ctx: impl AsContext<E>) -> ExternType

Returns the type associated with this Extern.

§Panics

If this item does not belong to the store provided.

Trait Implementations§

Source§

impl<E: WasmEngine> Clone for Extern<E>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: WasmEngine> Debug for Extern<E>
where E::Global: Debug, E::Func: Debug, E::Memory: Debug, E::Table: Debug,

Source§

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

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

impl<E: WasmEngine> From<&Extern<E>> for Extern

Source§

fn from(value: &Extern<E>) -> Self

Converts to this type from the input type.
Source§

impl<E: WasmEngine> From<&Extern> for Extern<E>

Source§

fn from(value: &Extern) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<E> Freeze for Extern<E>
where <E as WasmEngine>::Global: Freeze, <E as WasmEngine>::Table: Freeze, <E as WasmEngine>::Memory: Freeze, <E as WasmEngine>::Func: Freeze,

§

impl<E> RefUnwindSafe for Extern<E>

§

impl<E> Send for Extern<E>

§

impl<E> Sync for Extern<E>

§

impl<E> Unpin for Extern<E>
where <E as WasmEngine>::Global: Unpin, <E as WasmEngine>::Table: Unpin, <E as WasmEngine>::Memory: Unpin, <E as WasmEngine>::Func: Unpin,

§

impl<E> UnwindSafe for Extern<E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.