pub trait NetSession: NetStream + SplitIo {
type Inner: NetSession;
type Connection: NetConnection;
type Artifact: Display;
// Required methods
fn run_handshake(&mut self) -> Result<()>;
fn artifact(&self) -> Option<Self::Artifact>;
fn as_connection(&self) -> &Self::Connection;
fn as_connection_mut(&mut self) -> &mut Self::Connection;
fn disconnect(self) -> Result<()>;
// Provided methods
fn is_established(&self) -> bool { ... }
fn display(&self) -> String { ... }
}Required Associated Types§
Sourcetype Inner: NetSession
type Inner: NetSession
Inner session type
Sourcetype Connection: NetConnection
type Connection: NetConnection
Underlying connection
type Artifact: Display
Required Methods§
fn run_handshake(&mut self) -> Result<()>
fn artifact(&self) -> Option<Self::Artifact>
fn as_connection(&self) -> &Self::Connection
fn as_connection_mut(&mut self) -> &mut Self::Connection
fn disconnect(self) -> Result<()>
Provided Methods§
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.
Implementations on Foreign Types§
Source§impl NetSession for TcpStream
impl NetSession for TcpStream
type Inner = TcpStream
type Connection = TcpStream
type Artifact = SocketAddr
fn run_handshake(&mut self) -> Result<()>
fn artifact(&self) -> Option<Self::Artifact>
fn as_connection(&self) -> &Self::Connection
fn as_connection_mut(&mut self) -> &mut Self::Connection
fn disconnect(self) -> Result<()>
Source§impl NetSession for Socket
Available on crate feature socket2 only.
impl NetSession for Socket
Available on crate feature
socket2 only.