pub trait Handler {
type Error<E>: Debug
where E: Debug;
// Required method
async fn handle<T, const N: usize>(
&self,
task_id: impl Display + Copy,
connection: &mut Connection<'_, T, N>,
) -> Result<(), Self::Error<T::Error>>
where T: Read + Write + TcpSplit;
}Expand description
A trait (async callback) for handling incoming HTTP requests
Required Associated Types§
Required Methods§
Sourceasync fn handle<T, const N: usize>(
&self,
task_id: impl Display + Copy,
connection: &mut Connection<'_, T, N>,
) -> Result<(), Self::Error<T::Error>>
async fn handle<T, const N: usize>( &self, task_id: impl Display + Copy, connection: &mut Connection<'_, T, N>, ) -> Result<(), Self::Error<T::Error>>
Handle an incoming HTTP request
Parameters:
task_id: An identifier for the task, thast can be used by the handler for logging purposesconnection: A connection state machine for the request-response cycle
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.