Skip to main content

HostCapability

Trait HostCapability 

Source
pub trait HostCapability: Send + Sync {
    // Required methods
    fn interfaces(&self) -> Vec<String>;
    fn link(&self, linker: &mut Linker<ComponentState>) -> Result<()>;

    // Provided method
    fn create_state_boxed(
        &self,
    ) -> Result<Option<(TypeId, Box<dyn Any + Send>)>> { ... }
}
Expand description

Trait implemented by host capability instances.

An instance represents a configured capability (from one TOML block). Multiple TOML blocks with the same type create multiple instances.

Required Methods§

Source

fn interfaces(&self) -> Vec<String>

Fully qualified interfaces this capability provides (namespace:package/interface@version)

Add bindings to the linker. Called once per component instantiation.

Provided Methods§

Source

fn create_state_boxed(&self) -> Result<Option<(TypeId, Box<dyn Any + Send>)>>

Create per-component-instance state. Called once per component instantiation. Returns None if capability needs no per-instance state.

Implementors§