Skip to main content

ReplayWriter

Trait ReplayWriter 

pub trait ReplayWriter: Send + 'static {
    // Required methods
    fn poll_append(
        &mut self,
        cx: &mut Context<'_>,
        data: &Bytes,
    ) -> Poll<Result<(), Box<dyn Error + Sync + Send>>>;
    fn finish(
        self: Box<Self>,
        trailers: Option<HeaderMap>,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ReplaySource<Error = Box<dyn Error + Sync + Send>, Data = Bytes>>, Box<dyn Error + Sync + Send>>> + Send>>;
}
Available on crate features http and std only.
Expand description

Receives data frames in order for one upload.

The retry layer keeps the current frame available to the first attempt while the append is pending. An append error abandons capture. A deadline or cancellation can drop a pending operation and the writer at any time. Implementations must arrange for partial resources to be reclaimed.

Required Methods§

fn poll_append( &mut self, cx: &mut Context<'_>, data: &Bytes, ) -> Poll<Result<(), Box<dyn Error + Sync + Send>>>

Append one data frame. Until this returns ready, the caller keeps the same bytes and polls again with the current task’s waker. Store any in-flight write in self and arrange a wakeup when it can progress. A successful append consumes the entire frame.

fn finish( self: Box<Self>, trailers: Option<HeaderMap>, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ReplaySource<Error = Box<dyn Error + Sync + Send>, Data = Bytes>>, Box<dyn Error + Sync + Send>>> + Send>>

Seal the payload and trailers after EOF and successful completion of every append. Drop the writer if an append fails or capture is canceled.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§