Skip to main content

Service

Trait Service 

Source
pub trait Service:
    Sized
    + Send
    + 'static {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn initialize(
        context: ExecutionContext,
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
    fn run(
        &mut self,
        context: ExecutionContext,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided methods
    fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
    fn cleanup(
        &mut self,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
}

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn initialize( context: ExecutionContext, ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Source

fn run( &mut self, context: ExecutionContext, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Provided Methods§

Source

fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Source

fn cleanup(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§