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>
impl<E: WasmEngine> Extern<E>
Sourcepub fn into_global(self) -> Option<E::Global>
pub fn into_global(self) -> Option<E::Global>
Returns the underlying global variable if self is a global variable.
Returns None otherwise.
Sourcepub fn into_table(self) -> Option<E::Table>
pub fn into_table(self) -> Option<E::Table>
Returns the underlying table if self is a table.
Returns None otherwise.
Sourcepub fn into_memory(self) -> Option<E::Memory>
pub fn into_memory(self) -> Option<E::Memory>
Returns the underlying linear memory if self is a linear memory.
Returns None otherwise.
Trait Implementations§
Source§impl<E: WasmEngine> Clone for Extern<E>
impl<E: WasmEngine> Clone for Extern<E>
Source§impl<E: WasmEngine> Debug for Extern<E>
impl<E: WasmEngine> Debug for Extern<E>
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>where
<E as WasmEngine>::Global: RefUnwindSafe,
<E as WasmEngine>::Table: RefUnwindSafe,
<E as WasmEngine>::Memory: RefUnwindSafe,
<E as WasmEngine>::Func: RefUnwindSafe,
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>where
<E as WasmEngine>::Global: UnwindSafe,
<E as WasmEngine>::Table: UnwindSafe,
<E as WasmEngine>::Memory: UnwindSafe,
<E as WasmEngine>::Func: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more