pub trait WritableBody: Send {
type Data: AsRef<[u8]> + Send;
type Error: Error + Send + Sync + 'static;
// Required methods
fn write_frame(
&mut self,
frame: BodyFrame<Self::Data>,
cancellation: &Cancellation,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn flush(
&mut self,
cancellation: &Cancellation,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn close_write(&mut self, error: Option<Self::Error>);
fn abort(&mut self);
// Provided method
fn write(
&mut self,
data: Self::Data,
cancellation: &Cancellation,
) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
}Expand description
A body producer accepting owned frames with backpressure. Normal closure preserves accepted frames; failure abandons unfinished output. Flushing exposes accepted frames to the consumer, without promising peer receipt.
Required Associated Types§
Required Methods§
Sourcefn write_frame(
&mut self,
frame: BodyFrame<Self::Data>,
cancellation: &Cancellation,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn write_frame( &mut self, frame: BodyFrame<Self::Data>, cancellation: &Cancellation, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Accept one whole frame. Headers follow all data; a terminal frame closes output atomically with acceptance. Later writes fail. Queue capacity becoming available does not mean the transport has released its buffers.
fn flush( &mut self, cancellation: &Cancellation, ) -> impl Future<Output = Result<(), Self::Error>> + Send
fn close_write(&mut self, error: Option<Self::Error>)
fn abort(&mut self)
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".