Struct tokio_yamux::session::Session[][src]

pub struct Session<T> { /* fields omitted */ }

The session

Implementations

impl<T> Session<T> where
    T: AsyncRead + AsyncWrite + Unpin
[src]

pub fn new(raw_stream: T, config: Config, ty: SessionType) -> Session<T>[src]

Create a new session from a low level stream

pub fn new_server(raw_stream: T, config: Config) -> Session<T>[src]

Create a server session (typical raw_stream is an accepted TcpStream)

pub fn new_client(raw_stream: T, config: Config) -> Session<T>[src]

Create a client session

pub fn shutdown(&mut self, cx: &mut Context<'_>) -> Result<(), Error>[src]

shutdown is used to close the session and all streams. Attempts to send a GoAway before closing the connection.

pub fn send_go_away(&mut self, cx: &mut Context<'_>) -> Result<(), Error>[src]

GoAway can be used to prevent accepting further connections. It does not close the underlying conn.

pub fn open_stream(&mut self) -> Result<StreamHandle, Error>[src]

Open a new stream to remote session

pub fn control(&self) -> Control[src]

Return a control to async open stream/close session

Trait Implementations

impl<T> Stream for Session<T> where
    T: AsyncRead + AsyncWrite + Unpin
[src]

type Item = Result<StreamHandle, Error>

Values yielded by the stream.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Session<T>

impl<T> Send for Session<T> where
    T: Send

impl<T> Sync for Session<T> where
    T: Sync

impl<T> Unpin for Session<T> where
    T: Unpin

impl<T> !UnwindSafe for Session<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<St> StreamExt for St where
    St: Stream + ?Sized
[src]

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized