Skip to main content

OnBodyDrop

Trait OnBodyDrop 

Source
pub trait OnBodyDrop<ReqB> {
    type Intermediate: Send + 'static;
    type Callback: OnDropCallback;

    // Required methods
    fn make_at_call(&mut self, request: &Request<ReqB>) -> Self::Intermediate;
    fn make_at_response(
        &mut self,
        intermediate: Self::Intermediate,
        response_parts: &Parts,
    ) -> Self::Callback;
}
Available on crate feature on-early-drop only.
Expand description

Hook fired when the response body is dropped before reaching end-of-stream.

See the module docs for the example and phase breakdown.

Required Associated Types§

Source

type Intermediate: Send + 'static

State carried from make_at_call to make_at_response.

Source

type Callback: OnDropCallback

The final callback produced for each response.

Required Methods§

Source

fn make_at_call(&mut self, request: &Request<ReqB>) -> Self::Intermediate

Capture request-time context.

Source

fn make_at_response( &mut self, intermediate: Self::Intermediate, response_parts: &Parts, ) -> Self::Callback

Capture response-time context and produce the final callback.

Implementations on Foreign Types§

Source§

impl<ReqB> OnBodyDrop<ReqB> for ()

Source§

type Intermediate = ()

Source§

type Callback = NoopDropCallback

Source§

fn make_at_call(&mut self, _request: &Request<ReqB>) -> Self::Intermediate

Source§

fn make_at_response( &mut self, _intermediate: Self::Intermediate, _response_parts: &Parts, ) -> Self::Callback

Implementors§

Source§

impl<F, G, C, ReqB> OnBodyDrop<ReqB> for OnBodyDropFn<F>
where F: FnMut(&Request<ReqB>) -> G, G: FnOnce(&Parts) -> C + Send + 'static, C: OnDropCallback,

Source§

impl<F, ReqB> OnBodyDrop<ReqB> for EarlyDropsAsFailures<F>
where F: OnFailure<DroppedFailure> + Clone + Send + 'static,

Available on crate feature trace only.