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: &ServiceTaskContext,
    ) -> impl Future<Output = ()> + Send;

    // Provided method
    fn on_wait_end(&self) -> impl Future<Output = ()> + Send { ... }
}
Expand description

Defines service task behavior.

Required Methods§

Source

fn get_service_name(&self) -> String

Get the service name

Source

fn run(&self, context: &ServiceTaskContext) -> 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

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§