pub struct Exports { /* private fields */ }Expand description
Implementations§
Source§impl Exports
impl Exports
Sourcepub fn get<'a, T: Exportable<'a>>(&'a self, name: &str) -> ResolveResult<T>
pub fn get<'a, T: Exportable<'a>>(&'a self, name: &str) -> ResolveResult<T>
Get an export.
// We can get a function as a static `Func`
let func: Func<i32, i32> = instance.exports.get("my_func")?;
let _result = func.call(42);
// Or we can get it as a dynamic `DynFunc`
let dyn_func: DynFunc = instance.exports.get("my_func")?;
let _result= dyn_func.call(&[Value::I32(42)]);
// We can also get other exports like `Global`s, `Memory`s, and `Table`s
let _counter: Global = instance.exports.get("counter")?;
Sourcepub fn into_iter(&self) -> ExportIter<'_> ⓘ
pub fn into_iter(&self) -> ExportIter<'_> ⓘ
Iterate the exports.
for (export_name, export_value) in instance.exports.into_iter() {
println!("Found export `{}` with value `{:?}`", export_name, export_value);
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Exports
impl !RefUnwindSafe for Exports
impl !Sync for Exports
impl Unpin for Exports
impl !UnwindSafe for Exports
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