AsyncStream

Trait AsyncStream 

Source
pub trait AsyncStream:
    AsyncRead
    + AsyncWrite
    + Unpin
    + Send { }
Expand description

Supertrait that bundles the async IO bounds we need for an erased stream.

Rust trait objects only allow one non-auto trait, so we cannot write Box<dyn AsyncRead + AsyncWrite + …>. This supertrait collapses the bounds into a single name that is trait-object-compatible.

The blanket impl covers every concrete stream type we care about (TcpStream, TlsStream<TcpStream>), so wrapping is a zero-cost Box::new(stream).

Implementors§

Source§

impl<T: AsyncRead + AsyncWrite + Unpin + Send> AsyncStream for T