Skip to main content

ControlHandler

Trait ControlHandler 

Source
pub trait ControlHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(
        &self,
        request: ControlRequest,
    ) -> Pin<Box<dyn Future<Output = ControlResponse> + Send + '_>>;
}
Expand description

Asynchronously dispatch a single decoded ControlRequest against a local mob handle, returning the response shape.

Boxed-future trait so we can store this in a dyn field without requiring async-trait and so the listener doesn’t need a generic type parameter for the handler.

Required Methods§

Source

fn handle( &self, request: ControlRequest, ) -> Pin<Box<dyn Future<Output = ControlResponse> + Send + '_>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§