Struct wasm_component_layer::Linker
source · pub struct Linker { /* private fields */ }
Expand description
Provides the ability to define imports for a component and create Instance
s of it.
Implementations§
source§impl Linker
impl Linker
sourcepub fn root(&self) -> &LinkerInstance
pub fn root(&self) -> &LinkerInstance
Immutably obtains the root interface for this linker.
sourcepub fn root_mut(&mut self) -> &mut LinkerInstance
pub fn root_mut(&mut self) -> &mut LinkerInstance
Mutably obtains the root interface for this linker.
sourcepub fn define_instance(
&mut self,
name: InterfaceIdentifier
) -> Result<&mut LinkerInstance>
pub fn define_instance( &mut self, name: InterfaceIdentifier ) -> Result<&mut LinkerInstance>
Creates a new instance in the linker with the provided name. Returns an error if an instance with that name already exists.
sourcepub fn instance(&self, name: &InterfaceIdentifier) -> Option<&LinkerInstance>
pub fn instance(&self, name: &InterfaceIdentifier) -> Option<&LinkerInstance>
Immutably obtains the instance with the given name, if any.
sourcepub fn instance_mut(
&mut self,
name: &InterfaceIdentifier
) -> Option<&mut LinkerInstance>
pub fn instance_mut( &mut self, name: &InterfaceIdentifier ) -> Option<&mut LinkerInstance>
Mutably obtains the instance with the given name, if any.
sourcepub fn instances(
&self
) -> impl ExactSizeIterator<Item = (&InterfaceIdentifier, &LinkerInstance)>
pub fn instances( &self ) -> impl ExactSizeIterator<Item = (&InterfaceIdentifier, &LinkerInstance)>
Gets an immutable iterator over all instances defined in this linker.
sourcepub fn instances_mut(
&mut self
) -> impl ExactSizeIterator<Item = (&InterfaceIdentifier, &mut LinkerInstance)>
pub fn instances_mut( &mut self ) -> impl ExactSizeIterator<Item = (&InterfaceIdentifier, &mut LinkerInstance)>
Gets a mutable iterator over all instances defined in this linker.
sourcepub fn instantiate(
&self,
ctx: impl AsContextMut,
component: &Component
) -> Result<Instance>
pub fn instantiate( &self, ctx: impl AsContextMut, component: &Component ) -> Result<Instance>
Instantiates a component for the provided store, filling in its imports with externals defined in this linker. All imports must be defined for instantiation to succeed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Linker
impl Send for Linker
impl Sync for Linker
impl Unpin for Linker
impl !UnwindSafe for Linker
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