spin_trigger

Trait Trigger

Source
pub trait Trigger<F: RuntimeFactors>: Sized + Send {
    type CliArgs: Args;
    type InstanceState: Send + 'static;

    const TYPE: &'static str;

    // Required methods
    fn new(cli_args: Self::CliArgs, app: &App) -> Result<Self>;
    fn run(
        self,
        trigger_app: TriggerApp<Self, F>,
    ) -> impl Future<Output = Result<()>> + Send;

    // Provided methods
    fn add_to_linker(
        &mut self,
        linker: &mut Linker<InstanceState<<F as RuntimeFactors>::InstanceState, <Self as Trigger<F>>::InstanceState>>,
    ) -> Result<()> { ... }
    fn supported_host_requirements() -> Vec<&'static str> { ... }
}
Expand description

A trigger for a Spin runtime.

Required Associated Constants§

Source

const TYPE: &'static str

A unique identifier for this trigger.

Required Associated Types§

Source

type CliArgs: Args

The specific CLI arguments for this trigger.

Source

type InstanceState: Send + 'static

The instance state for this trigger.

Required Methods§

Source

fn new(cli_args: Self::CliArgs, app: &App) -> Result<Self>

Constructs a new trigger.

Source

fn run( self, trigger_app: TriggerApp<Self, F>, ) -> impl Future<Output = Result<()>> + Send

Run this trigger.

Provided Methods§

Source

fn add_to_linker( &mut self, linker: &mut Linker<InstanceState<<F as RuntimeFactors>::InstanceState, <Self as Trigger<F>>::InstanceState>>, ) -> Result<()>

Update the Linker for this trigger.

Source

fn supported_host_requirements() -> Vec<&'static str>

Returns a list of host requirements supported by this trigger specifically.

See App::ensure_needs_only.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F: RuntimeFactors> Trigger<F> for HelpArgsOnlyTrigger

Source§

const TYPE: &'static str = "help-args-only"

Source§

type CliArgs = NoCliArgs

Source§

type InstanceState = ()