pub trait RequestHandler {
// Provided methods
fn on_body_chunk<B>(&mut self, _chunk: &B)
where B: Buf { ... }
fn on_end_of_stream(&mut self, _trailers: Option<&HeaderMap>) { ... }
fn on_body_error<E>(&mut self, _error: &E)
where E: Display + 'static { ... }
}Expand description
Observes the request body as it is polled by the inner service.
All methods default to no-ops, so implementors only override the
events they care about. The unit type () has a blanket impl with
every method a no-op; use type RequestHandler = (); when only the
response side is interesting.
Provided Methods§
Sourcefn on_body_chunk<B>(&mut self, _chunk: &B)where
B: Buf,
fn on_body_chunk<B>(&mut self, _chunk: &B)where
B: Buf,
Called once per data frame yielded by the request body.
Sourcefn on_end_of_stream(&mut self, _trailers: Option<&HeaderMap>)
fn on_end_of_stream(&mut self, _trailers: Option<&HeaderMap>)
Called at most once when the request body stream ends.
trailers is Some if the final frame was a trailers frame,
otherwise None.
Sourcefn on_body_error<E>(&mut self, _error: &E)where
E: Display + 'static,
fn on_body_error<E>(&mut self, _error: &E)where
E: Display + 'static,
Called when polling the request body yields an error.
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.