Trait BodyCaptureSink
pub trait BodyCaptureSink:
Send
+ Sync
+ 'static {
// Required method
fn capture(
&self,
event: BodyCaptureEvent,
) -> impl Future<Output = ()> + Send + 'static;
// Provided method
fn aborted(&self) { ... }
}Available on crate features
http and std only.Expand description
Asynchronously observes owned body events.
The future returned by capture is polled before the
original frame or terminal state is forwarded. Implementations therefore
choose their own flow-control policy: they can perform work directly, await
a bounded queue, enqueue without waiting, or return immediately.
Required Methods§
fn capture(
&self,
event: BodyCaptureEvent,
) -> impl Future<Output = ()> + Send + 'static
fn capture( &self, event: BodyCaptureEvent, ) -> impl Future<Output = ()> + Send + 'static
Capture one body event.
The returned future must own everything it needs because it can outlive
the borrow of self.
Provided Methods§
fn aborted(&self)
fn aborted(&self)
Notify the sink synchronously when the body is abandoned.
Destructors cannot await. Implementations that need asynchronous work can perform a non-blocking send or arrange for their own guard to finish that work.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".