Trait SendStream
pub trait SendStream:
Send
+ Sync
+ Unpin
+ 'static {
type Handle: StreamHandle;
// Required methods
fn id(&self) -> StreamId;
fn poll_write_chunks(
&mut self,
cx: &mut Context<'_>,
chunks: &mut [Bytes],
reserve: u64,
) -> Poll<Result<(), WriteError>>;
fn try_write_generated(
&mut self,
reserve: u64,
generate: impl FnOnce(usize) -> Bytes,
) -> Result<(), WriteError>;
fn finish(&mut self) -> Result<(), ClosedStream>;
fn reset(&mut self, error_code: VarInt) -> Result<(), ClosedStream>;
fn set_priority(&self, priority: i32) -> Result<(), ClosedStream>;
fn stopped(
&self,
) -> impl Future<Output = Result<Option<VarInt>, StoppedError>> + Send + Sync + 'static + use<Self>;
fn handle(&self) -> Self::Handle;
// Provided method
fn boxed_handle(&self) -> Arc<dyn StreamHandle> ⓘ { ... }
}http-backend and http and std only.Required Associated Types§
type Handle: StreamHandle
Required Methods§
fn id(&self) -> StreamId
fn poll_write_chunks(
&mut self,
cx: &mut Context<'_>,
chunks: &mut [Bytes],
reserve: u64,
) -> Poll<Result<(), WriteError>>
fn poll_write_chunks( &mut self, cx: &mut Context<'_>, chunks: &mut [Bytes], reserve: u64, ) -> Poll<Result<(), WriteError>>
Write a prefix of chunks, consuming what was written.
All accepted bytes must be removed from chunks, including partial chunks, on every
poll. When returning Pending, arrange to wake cx when writing can make progress.
reserve bytes of connection send credit stay unused, so the control and QPACK streams
can still send behind large bodies. A transport may ignore it.
fn try_write_generated(
&mut self,
reserve: u64,
generate: impl FnOnce(usize) -> Bytes,
) -> Result<(), WriteError>
fn try_write_generated( &mut self, reserve: u64, generate: impl FnOnce(usize) -> Bytes, ) -> Result<(), WriteError>
Write the chunk generate builds for the credit available now (minus reserve, 0 if
unknown), calling it exactly once and atomically: QPACK commits encoder state inside it.
fn finish(&mut self) -> Result<(), ClosedStream>
fn finish(&mut self) -> Result<(), ClosedStream>
Finish this SendStream
fn reset(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
fn reset(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
Reset this SendStream with the given error_code
fn set_priority(&self, priority: i32) -> Result<(), ClosedStream>
fn set_priority(&self, priority: i32) -> Result<(), ClosedStream>
Set priority of this stream
fn stopped(
&self,
) -> impl Future<Output = Result<Option<VarInt>, StoppedError>> + Send + Sync + 'static + use<Self>
fn stopped( &self, ) -> impl Future<Output = Result<Option<VarInt>, StoppedError>> + Send + Sync + 'static + use<Self>
Resolves with the peer’s STOP_SENDING code, or None once all data is acknowledged.
fn handle(&self) -> Self::Handle
Provided Methods§
fn boxed_handle(&self) -> Arc<dyn StreamHandle> ⓘ
fn boxed_handle(&self) -> Arc<dyn StreamHandle> ⓘ
Erase the stream handle’s type, reusing an existing shared handle when available.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".