Skip to main content

PromisedStream

Trait PromisedStream 

Source
pub trait PromisedStream:
    Connection
    + Unpin
    + Send
    + Sync
    + 'static {
    type Instant: Instant + Send + Sync + 'static;

    // Required methods
    fn local_addr(&self) -> SocketAddr;
    fn peer_addr(&self) -> SocketAddr;
}
Expand description

Represents a network connection.

This trait encapsulates functionality for a network connection that supports asynchronous read/write operations and can be split into separate read and write halves.

Required Associated Types§

Source

type Instant: Instant + Send + Sync + 'static

The instant type

Required Methods§

Source

fn local_addr(&self) -> SocketAddr

Returns the address of the local endpoint of the connection.

Source

fn peer_addr(&self) -> SocketAddr

Returns the address of the remote endpoint of the connection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R: Runtime> PromisedStream for TcpStream<R>

Source§

impl<R: Runtime> PromisedStream for TlsStream<R>

Available on crate feature tls only.