Skip to main content

Strategy

Trait Strategy 

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

A strategy that runs until cancelled or a fatal error occurs.

Each implementation subscribes to the node’s event stream and/or creates internal timers in run. The trait is trivially object-safe: run takes only &mut self, so strategies can be held as Box<dyn Strategy + Send>.

Any type implementing this trait can be composed into a MultiStrategy without any changes to this crate.

Required Methods§

Source

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

Run the strategy. Returns only on cancellation or fatal error.

Implementors§