Skip to main content

BodyCaptureSink

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

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)

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".

Implementations on Foreign Types§

§

impl BodyCaptureSink for Sender<BodyCaptureEvent>

§

fn capture( &self, event: BodyCaptureEvent, ) -> impl Future<Output = ()> + Send + 'static

§

fn aborted(&self)

§

impl BodyCaptureSink for UnboundedSender<BodyCaptureEvent>

§

fn capture( &self, event: BodyCaptureEvent, ) -> impl Future<Output = ()> + Send + 'static

§

fn aborted(&self)

Implementors§

§

impl BodyCaptureSink for BufferedBodyCapture

§

impl<F, Fut> BodyCaptureSink for F
where F: Fn(BodyCaptureEvent) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,