Trait RunCommandExt

Source
pub trait RunCommandExt<R: Runtime + ?Sized> {
    type Item: 'static;

    // Required method
    fn as_command<'a, H, Fh>(
        self,
        ctx: &mut Context<R>,
        handler: H,
    ) -> ProcessIdResponse<'a>
       where H: FnOnce(Self::Item, RunCommandContext) -> Fh + 'static,
             Fh: Future<Output = Result<(), Error>> + 'static;
}
Expand description

Wraps command lifecycle in the following manner:

  • manages command sequence numbers
  • emits command start & stop events
  • provides a RunCommandContext object for easier output event emission

Required Associated Types§

Source

type Item: 'static

Required Methods§

Source

fn as_command<'a, H, Fh>( self, ctx: &mut Context<R>, handler: H, ) -> ProcessIdResponse<'a>
where H: FnOnce(Self::Item, RunCommandContext) -> Fh + 'static, Fh: Future<Output = Result<(), Error>> + 'static,

Wrap self in run_command

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<R, F, Rt, Re> RunCommandExt<R> for F
where R: Runtime + ?Sized, <R as RuntimeDef>::Cli: 'static, F: Future<Output = Result<Rt, Re>> + 'static, Rt: 'static, Re: 'static, Error: From<Re>,

Implements RunCommandExt for Futures outputting Results. The output result is checked prior to emitting any command lifecycle events.

Source§

type Item = Rt