Skip to main content

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> { ... }
    fn display_name() -> String { ... }
}
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.

Source

fn display_name() -> String

Returns the display name for the type of this trigger. Defaults to title case.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

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

Source§

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

Source§

type CliArgs = NoCliArgs

Source§

type InstanceState = ()