Skip to main content

ServiceTask

Trait ServiceTask 

Source
pub trait ServiceTask: Sync + Send {
    // Required methods
    fn get_service_name(&self) -> String;
    fn run(&self, context: &ServiceContext) -> impl Future<Output = ()> + Send;

    // Provided methods
    fn on_wait_end(&self) -> impl Future<Output = ()> + Send { ... }
    fn get_join_time(&self) -> Duration { ... }
}

Required Methods§

Source

fn get_service_name(&self) -> String

Get the service name

Source

fn run(&self, context: &ServiceContext) -> impl Future<Output = ()> + Send

implement the service logic here

Provided Methods§

Source

fn on_wait_end(&self) -> impl Future<Output = ()> + Send

override for custom behavior

Source

fn get_join_time(&self) -> Duration

Get join time for shutdown (default 90 seconds)

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§