TaskHandler

Trait TaskHandler 

Source
pub trait TaskHandler<Payload, Context>: Send
where Payload: for<'de> Deserialize<'de> + Serialize + Send, Context: Send,
{ // Required method fn run( &self, payload: Payload, ctx: Context, ) -> impl Future<Output = Result<(), String>> + Send + 'static; // Provided method fn identifier(&self) -> &str { ... } }

Required Methods§

Source

fn run( &self, payload: Payload, ctx: Context, ) -> impl Future<Output = Result<(), String>> + Send + 'static

Provided Methods§

Source

fn identifier(&self) -> &str

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Payload, Context, Error, F, Fut> TaskHandler<Payload, Context> for F
where Payload: for<'de> Deserialize<'de> + Serialize + Send, Context: Send, Error: Debug + Send, Fut: Future<Output = Result<(), Error>> + Send + 'static, F: Fn(Payload, Context) -> Fut + Send,