pub trait Reactor: Driver {
// Required methods
fn tcp_connect(&self, addr: SocketAddr, cfg: SharedCfg) -> Receiver<Io> ⓘ;
fn unix_connect(&self, addr: PathBuf, cfg: SharedCfg) -> Receiver<Io> ⓘ;
fn from_tcp_stream(&self, stream: TcpStream, cfg: SharedCfg) -> Result<Io>;
fn from_unix_stream(&self, _: UnixStream, _: SharedCfg) -> Result<Io>;
// Provided methods
fn tcp_listener(&self, sock: TcpListener) -> Result<Listener> { ... }
fn is_tcp_listener_supported(&self) -> bool { ... }
}Expand description
Runtime reactor used for network connection and transport operations.
Required Methods§
Sourcefn tcp_connect(&self, addr: SocketAddr, cfg: SharedCfg) -> Receiver<Io> ⓘ
fn tcp_connect(&self, addr: SocketAddr, cfg: SharedCfg) -> Receiver<Io> ⓘ
Starts an asynchronous TCP connection.
Sourcefn unix_connect(&self, addr: PathBuf, cfg: SharedCfg) -> Receiver<Io> ⓘ
fn unix_connect(&self, addr: PathBuf, cfg: SharedCfg) -> Receiver<Io> ⓘ
Starts an asynchronous Unix domain socket connection.
Sourcefn from_tcp_stream(&self, stream: TcpStream, cfg: SharedCfg) -> Result<Io>
fn from_tcp_stream(&self, stream: TcpStream, cfg: SharedCfg) -> Result<Io>
Converts a standard-library TCP stream into an [Io] value.
The reactor does not change TCP_NODELAY; the stream keeps the value
it already has. Callers that need low latency must call
stream.set_nodelay(true) before converting the stream, unless the
option is already set, for example inherited from a listener with
TCP_NODELAY enabled on Linux and macOS.
Sourcefn from_unix_stream(&self, _: UnixStream, _: SharedCfg) -> Result<Io>
fn from_unix_stream(&self, _: UnixStream, _: SharedCfg) -> Result<Io>
Converts a standard-library Unix stream into an [Io] value.
Provided Methods§
Sourcefn tcp_listener(&self, sock: TcpListener) -> Result<Listener>
fn tcp_listener(&self, sock: TcpListener) -> Result<Listener>
Registers a TCP listener with the reactor.
The default implementation returns an io::ErrorKind::Unsupported
error.
Sourcefn is_tcp_listener_supported(&self) -> bool
fn is_tcp_listener_supported(&self) -> bool
Returns true if tcp_listener is supported.
The default implementation returns false.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".