pub struct WithExports { /* private fields */ }
runtime
and crate feature component-model
and docsrs
only.Expand description
Auto-generated bindings for an instance a component which
implements the world with-exports
.
This structure can be created through a number of means depending on your requirements and what you have on hand:
-
The most convenient way is to use
WithExports::instantiate
which only needs aStore
,Component
, andLinker
. -
Alternatively you can create a
WithExportsPre
ahead of time with aComponent
to front-load string lookups of exports once instead of per-instantiation. This method then usesWithExportsPre::instantiate
to create aWithExports
. -
If you’ve instantiated the instance yourself already then you can use
WithExports::new
. -
You can also access the guts of instantiation through
WithExportsIndices::new_instance
followed byWithExportsIndices::load
to crate an instance of this type.
These methods are all equivalent to one another and move around the tradeoff of what work is performed when.
Implementations§
source§impl WithExports
impl WithExports
sourcepub fn instantiate<_T>(
store: impl AsContextMut<Data = _T>,
component: &Component,
linker: &Linker<_T>,
) -> Result<WithExports>
pub fn instantiate<_T>( store: impl AsContextMut<Data = _T>, component: &Component, linker: &Linker<_T>, ) -> Result<WithExports>
Convenience wrapper around WithExportsPre::new
and
WithExportsPre::instantiate
.
sourcepub fn new(store: impl AsContextMut, instance: &Instance) -> Result<WithExports>
pub fn new(store: impl AsContextMut, instance: &Instance) -> Result<WithExports>
Convenience wrapper around WithExportsIndices::new_instance
and
WithExportsIndices::load
.