Trait Service

Source
pub trait Service: Sync + Send {
    // Required methods
    fn spawn<'async_trait>(
        self: Arc<Self>,
        runtime: Runtime,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn terminate(self: Arc<Self>);
    fn join<'async_trait>(
        self: Arc<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided method
    fn name(&self) -> &'static str { ... }
}

Required Methods§

Source

fn spawn<'async_trait>( self: Arc<Self>, runtime: Runtime, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Start the service

Source

fn terminate(self: Arc<Self>)

Signal the service termination (post a shutdown request)

Source

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

Block until the service is terminated

Provided Methods§

Source

fn name(&self) -> &'static str

Implementors§