Skip to main content

DataHandler

Trait DataHandler 

Source
pub trait DataHandler<S> {
    type Args: FromRequestParts<S> + Send + Sync;
    type Body: DeserializeOwned + 'static;
    type Error: Error + Send;
    type Extension: Clone + Send + Sync + 'static;

    // Required method
    fn process_data(
        &self,
        params: Self::Args,
        body: Self::Body,
    ) -> impl Future<Output = Result<Self::Extension, Self::Error>> + Send;
}
Expand description

Handles incoming data

  • Self::Args - This can be used to receive Args from the request using anything that is axum::extract::FromRequestParts
  • Self::Body - The data which should be received through the request. This is supposed to be the struct, not the axum extractor.
  • Self::Error - The error type which gets emitted when something fails
  • Self::Extension - Anything that can contain additional data to indicate success (like a message)

Required Associated Types§

Required Methods§

Source

fn process_data( &self, params: Self::Args, body: Self::Body, ) -> impl Future<Output = Result<Self::Extension, Self::Error>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§