pub trait DynamicHostComponent: HostComponent {
    // Required method
    fn update_data(
        &self,
        data: &mut Self::Data,
        component: &AppComponent<'_>
    ) -> Result<()>;

    // Provided method
    fn validate_app(&self, app: &App<'_>) -> Result<()> { ... }
}
Expand description

A trait for “dynamic” Spin host components.

This extends HostComponent to support per-AppComponent dynamic runtime configuration.

Dynamic host components differ from regular host components in that they can be configured on a per-component basis.

Required Methods§

source

fn update_data( &self, data: &mut Self::Data, component: &AppComponent<'_> ) -> Result<()>

Called on AppComponent instance initialization.

The data returned by HostComponent::build_data is passed, along with a reference to the component being instantiated.

Provided Methods§

source

fn validate_app(&self, app: &App<'_>) -> Result<()>

Called on App load to validate any configuration needed by this host component.

Note that the absence of configuration should not be treated as an error here, as the app may not use this host component at all.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<DHC: DynamicHostComponent> DynamicHostComponent for Arc<DHC>

source§

fn update_data( &self, data: &mut Self::Data, component: &AppComponent<'_> ) -> Result<()>

Implementors§