pub struct Exports { /* private fields */ }
Expand description
Exports is a special kind of map that allows easily unwrapping the types of instances.
TODO: add examples of using exports
Implementations§
source§impl Exports
impl Exports
sourcepub fn with_capacity(n: usize) -> Self
pub fn with_capacity(n: usize) -> Self
Creates a new Exports
with capacity n
.
sourcepub fn insert<S, E>(&mut self, name: S, value: E)where
S: Into<String>,
E: Into<Extern>,
pub fn insert<S, E>(&mut self, name: S, value: E)where S: Into<String>, E: Into<Extern>,
Insert a new export into this Exports
map.
sourcepub fn get<'a, T: Exportable<'a>>(
&'a self,
name: &str
) -> Result<&'a T, ExportError>
pub fn get<'a, T: Exportable<'a>>( &'a self, name: &str ) -> Result<&'a T, ExportError>
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
.
sourcepub fn get_global(&self, name: &str) -> Result<&Global, ExportError>
pub fn get_global(&self, name: &str) -> Result<&Global, ExportError>
Get an export as a Global
.
sourcepub fn get_memory(&self, name: &str) -> Result<&Memory, ExportError>
pub fn get_memory(&self, name: &str) -> Result<&Memory, ExportError>
Get an export as a Memory
.
sourcepub fn get_function(&self, name: &str) -> Result<&Function, ExportError>
pub fn get_function(&self, name: &str) -> Result<&Function, ExportError>
Get an export as a Func
.
sourcepub fn get_native_function<Args, Rets>(
&self,
store: &impl AsStoreRef,
name: &str
) -> Result<TypedFunction<Args, Rets>, ExportError>where
Args: WasmTypeList,
Rets: WasmTypeList,
👎Deprecated since 3.0.0: get_native_function() has been renamed to get_typed_function(), just like NativeFunc has been renamed to TypedFunction.
pub fn get_native_function<Args, Rets>( &self, store: &impl AsStoreRef, name: &str ) -> Result<TypedFunction<Args, Rets>, ExportError>where Args: WasmTypeList, Rets: WasmTypeList,
Get an export as a TypedFunction
.
sourcepub fn get_typed_function<Args, Rets>(
&self,
store: &impl AsStoreRef,
name: &str
) -> Result<TypedFunction<Args, Rets>, ExportError>where
Args: WasmTypeList,
Rets: WasmTypeList,
pub fn get_typed_function<Args, Rets>( &self, store: &impl AsStoreRef, name: &str ) -> Result<TypedFunction<Args, Rets>, ExportError>where Args: WasmTypeList, Rets: WasmTypeList,
Get an export as a TypedFunction
.
sourcepub 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>,
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>,
Hack to get this working with nativefunc too
sourcepub fn get_extern(&self, name: &str) -> Option<&Extern>
pub fn get_extern(&self, name: &str) -> Option<&Extern>
Get an export as an Extern
.
Trait Implementations§
source§impl<'a> IntoIterator for &'a Exports
impl<'a> IntoIterator for &'a Exports
source§impl IntoIterator for Exports
impl IntoIterator for Exports
source§impl PartialEq<Exports> for Exports
impl PartialEq<Exports> for Exports
impl Eq for Exports
impl StructuralEq for Exports
impl StructuralPartialEq for Exports
Auto Trait Implementations§
impl RefUnwindSafe for Exports
impl Send for Exports
impl Sync for Exports
impl Unpin for Exports
impl UnwindSafe for Exports
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.