Skip to main content

SocketRegistration

Trait SocketRegistration 

Source
pub trait SocketRegistration: SocketOperation {
    // Required methods
    fn register_socket(&self, socket: TcpStream) -> Result<Self::Socket>;
    fn register_listener(&self, listener: TcpListener) -> Result<Self::Socket>;
}
Expand description

Optional interoperability with existing standard-library TCP resources. Streams and listeners become the same backend socket descriptor. Register once; the backend sets the nonblocking mode it needs. Do not change that mode through another handle. Simulated schedulers need not implement it.

Required Methods§

Source

fn register_socket(&self, socket: TcpStream) -> Result<Self::Socket>

Take ownership of a connected standard-library TCP stream and return it as this scheduler’s socket.

Source

fn register_listener(&self, listener: TcpListener) -> Result<Self::Socket>

Take ownership of a standard-library TCP listener and return it as this scheduler’s socket.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§