Skip to main content

Runnable

Trait Runnable 

Source
pub trait Runnable:
    Send
    + Sync
    + 'static {
    // Required method
    fn run<'async_trait>(
        self: Arc<Self>,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Trait for modules that can run a long-running task. Note: take self by Arc to make the spawned future 'static and Send.

Required Methods§

Source

fn run<'async_trait>( self: Arc<Self>, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Long-running loop. Must return when cancel is cancelled.

Implementors§