Skip to main content

ByteStream

Trait ByteStream 

Source
pub trait ByteStream:
    AsyncRead
    + AsyncWrite
    + Send
    + Sync
    + Unpin {
    // Required methods
    fn peer_endpoint(&self) -> Option<Endpoint>;
    fn local_endpoint(&self) -> Option<Endpoint>;

    // Provided method
    fn peer_certificates(&self) -> Option<Vec<CertificateDer<'static>>> { ... }
}
Expand description

Byte-oriented bidirectional stream.

Implemented by TCP, TLS, Unix, and QUIC streams. Extends AsyncRead + AsyncWrite for compatibility with IO libraries. Use framed() to convert into a FramedConn with a codec.

Required Methods§

Source

fn peer_endpoint(&self) -> Option<Endpoint>

Remote peer address, if available.

Source

fn local_endpoint(&self) -> Option<Endpoint>

Local address, if available.

Provided Methods§

Source

fn peer_certificates(&self) -> Option<Vec<CertificateDer<'static>>>

Peer certificate chain when the underlying transport authenticates the peer with X.509 (TLS, QUIC). Returns None for plain TCP/Unix and other unauthenticated transports.

Implementors§