Trait NetSession

Source
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§

Source

type Inner: NetSession

Inner session type

Source

type Connection: NetConnection

Underlying connection

Source

type Artifact: Display

Required Methods§

Source

fn run_handshake(&mut self) -> Result<()>

Source

fn artifact(&self) -> Option<Self::Artifact>

Source

fn as_connection(&self) -> &Self::Connection

Source

fn as_connection_mut(&mut self) -> &mut Self::Connection

Source

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

Source§

impl NetSession for Socket

Available on crate feature socket2 only.

Implementors§