[][src]Struct wasmer::Exports

pub struct Exports { /* fields omitted */ }

Exports is a special kind of map that allows easily unwrapping the types of instances.

TODO: add examples of using exports

Implementations

impl Exports[src]

pub fn new() -> Self[src]

Creates a new Exports.

pub fn with_capacity(n: usize) -> Self[src]

Creates a new Exports with capacity n.

pub fn len(&self) -> usize[src]

Return the number of exports in the Exports map.

pub fn is_empty(&self) -> bool[src]

Return whether or not there are no exports

pub fn insert<S, E>(&mut self, name: S, value: E) where
    S: Into<String>,
    E: Into<Extern>, 
[src]

Insert a new export into this Exports map.

pub fn get<'a, T: Exportable<'a>>(
    &'a self,
    name: &str
) -> Result<&'a T, ExportError>
[src]

Get an export given a name.

The get method is specifically made for usage inside of Rust APIs, as we can detect what's the desired type easily.

If you want to get an export dynamically with type checking please use the following functions: get_func, get_memory, get_table or get_global instead.

If you want to get an export dynamically handling manually type checking manually, please use get_extern.

pub fn get_global(&self, name: &str) -> Result<&Global, ExportError>[src]

Get an export as a Global.

pub fn get_memory(&self, name: &str) -> Result<&Memory, ExportError>[src]

Get an export as a Memory.

pub fn get_table(&self, name: &str) -> Result<&Table, ExportError>[src]

Get an export as a Table.

pub fn get_function(&self, name: &str) -> Result<&Function, ExportError>[src]

Get an export as a Func.

pub fn get_native_function<Args, Rets>(
    &self,
    name: &str
) -> Result<NativeFunc<Args, Rets>, ExportError> where
    Args: WasmTypeList,
    Rets: WasmTypeList
[src]

Get an export as a NativeFunc.

pub fn get_with_generics<'a, T, Args, Rets>(
    &'a self,
    name: &str
) -> Result<T, ExportError> where
    Args: WasmTypeList,
    Rets: WasmTypeList,
    T: ExportableWithGenerics<'a, Args, Rets>, 
[src]

Hack to get this working with nativefunc too

pub fn get_extern(&self, name: &str) -> Option<&Extern>[src]

Get an export as an Extern.

pub fn contains<S>(&self, name: S) -> bool where
    S: Into<String>, 
[src]

Returns true if the Exports contains the given export name.

pub fn iter(
    &self
) -> ExportsIterator<'_, impl Iterator<Item = (&String, &Extern)>>

Notable traits for ExportsIterator<'a, I>

impl<'a, I> Iterator for ExportsIterator<'a, I> where
    I: Iterator<Item = (&'a String, &'a Extern)> + Sized
type Item = (&'a String, &'a Extern);
[src]

Get an iterator over the exports.

Trait Implementations

impl Clone for Exports[src]

impl Debug for Exports[src]

impl Default for Exports[src]

impl FromIterator<(String, Extern)> for Exports[src]

impl LikeNamespace for Exports[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,