handle_request

Function handle_request 

Source
pub async fn handle_request<H, T, const N: usize>(
    buf: &mut [u8],
    io: T,
    task_id: impl Display + Copy,
    handler: H,
) -> Result<bool, HandlerError<T::Error, H::Error<T::Error>>>
where H: Handler, T: Read + Write + TcpSplit,
Expand description

A convenience function to handle a single HTTP request over a socket stream, using the specified handler.

Note that this function does not set any timeouts on the request-response processing or on the IO operations. It is up that the caller to use the with_timeout function and the WithTimeout struct from the edge-nal crate to wrap the future returned by this function, or the socket stream, or both.

Parameters:

  • buf: A work-area buffer used by the implementation
  • io: A socket stream
  • task_id: An identifier for the task, used for logging purposes
  • handler: An implementation of Handler to handle incoming requests