Enum wasm_runtime_layer::Extern

source ·
pub enum Extern {
    Global(Global),
    Table(Table),
    Memory(Memory),
    Func(Func),
}
Expand description

An external item to a WebAssembly module.

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

Variants§

§

Global(Global)

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

§

Table(Table)

A WebAssembly table which is an array of funtion references.

§

Memory(Memory)

A WebAssembly linear memory.

§

Func(Func)

A WebAssembly function which can be called.

Implementations§

source§

impl Extern

source

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

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

Returns None otherwise.

source

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

Returns the underlying table if self is a table.

Returns None otherwise.

source

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

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

Returns None otherwise.

source

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

Returns the underlying function if self is a function.

Returns None otherwise.

source

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

Returns the type associated with this Extern.

Trait Implementations§

source§

impl Clone for Extern

source§

fn clone(&self) -> Extern

Returns a copy 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 Debug for Extern

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 Freeze for Extern

§

impl !RefUnwindSafe for Extern

§

impl Send for Extern

§

impl Sync for Extern

§

impl Unpin for Extern

§

impl !UnwindSafe for Extern

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

§

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>,

§

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>,

§

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.