Skip to main content

CommandSource

Trait CommandSource 

Source
pub trait CommandSource: Send + Sync {
    // Required method
    fn next<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Command>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Pull-model command source.

next() returns:

  • Ok(Some(cmd)) — one command to dispatch.
  • Ok(None) — the source is exhausted (local-mode playbook complete) and the executor should drain its outstanding work and exit. Long-running sources (worker NATS) never return None in normal operation.
  • Err(e) — transient or terminal source error; the caller’s retry policy decides whether to call next() again.

Required Methods§

Source

fn next<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<Command>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§