Trait StreamHandle
pub trait StreamHandle:
Send
+ Sync
+ 'static {
// Required methods
fn abort(&self, error_code: VarInt);
fn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>;
fn try_send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>;
}Available on crate features
http-backend and http and std only.Expand description
Shared control over a stream whose SendStream moved to its writer: abort both
directions, or send datagrams bound to the stream.
Required Methods§
fn abort(&self, error_code: VarInt)
fn abort(&self, error_code: VarInt)
Abort both available directions. Already closed directions are harmless.
fn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>
fn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>
Queue a datagram bound to this stream, dropping the oldest queued ones for space.
The send side state is checked atomically with queueing: fails with
SendDatagramError::Closed once it ended.
fn try_send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>
fn try_send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>
As Self::send_datagram, but a full send buffer fails instead.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".