ModuleHandlers

Trait ModuleHandlers 

Source
pub trait ModuleHandlers {
    // Required method
    fn request_handler<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        request: Request<BoxBody<Bytes, Error>>,
        config: &'life1 ServerConfiguration,
        socket_data: &'life2 SocketData,
        error_logger: &'life3 ErrorLogger,
    ) -> Pin<Box<dyn Future<Output = Result<ResponseData, Box<dyn Error + Send + Sync>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided methods
    fn response_modifying_handler<'life0, 'async_trait>(
        &'life0 mut self,
        response: Response<BoxBody<Bytes, Error>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<BoxBody<Bytes, Error>>, Box<dyn Error>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn metric_data_before_handler<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        request: &'life1 Request<BoxBody<Bytes, Error>>,
        socket_data: &'life2 SocketData,
        metrics_sender: &'life3 MetricsMultiSender,
    ) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn metric_data_after_handler<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        metrics_sender: &'life1 MetricsMultiSender,
    ) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn get_name(&self) -> &'static str { ... }
}
Expand description

A trait that defines handlers for a module

Required Methods§

Source

fn request_handler<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, request: Request<BoxBody<Bytes, Error>>, config: &'life1 ServerConfiguration, socket_data: &'life2 SocketData, error_logger: &'life3 ErrorLogger, ) -> Pin<Box<dyn Future<Output = Result<ResponseData, Box<dyn Error + Send + Sync>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Handles the incoming request

Provided Methods§

Source

fn response_modifying_handler<'life0, 'async_trait>( &'life0 mut self, response: Response<BoxBody<Bytes, Error>>, ) -> Pin<Box<dyn Future<Output = Result<Response<BoxBody<Bytes, Error>>, Box<dyn Error>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Modifies the outgoing response

Source

fn metric_data_before_handler<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, request: &'life1 Request<BoxBody<Bytes, Error>>, socket_data: &'life2 SocketData, metrics_sender: &'life3 MetricsMultiSender, ) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Sends metric data before handling the request

Source

fn metric_data_after_handler<'life0, 'life1, 'async_trait>( &'life0 mut self, metrics_sender: &'life1 MetricsMultiSender, ) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends metric data after modifying the response

Source

fn get_name(&self) -> &'static str

Gets the module handlers’ type name

Implementors§