Struct yamux::Connection
source · [−]pub struct Connection<T> { /* private fields */ }
Expand description
A Yamux connection object.
Wraps the underlying I/O resource and makes progress via its
Connection::next_stream
method which must be called repeatedly
until Ok(None)
signals EOF or an error is encountered.
Implementations
sourceimpl<T: AsyncRead + AsyncWrite + Unpin> Connection<T>
impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T>
sourcepub fn new(socket: T, cfg: Config, mode: Mode) -> Self
pub fn new(socket: T, cfg: Config, mode: Mode) -> Self
Create a new Connection
from the given I/O resource.
sourcepub async fn next_stream(&mut self) -> Result<Option<Stream>, ConnectionError>
pub async fn next_stream(&mut self) -> Result<Option<Stream>, ConnectionError>
Get the next incoming stream, opened by the remote.
This must be called repeatedly in order to make progress.
Once Ok(None)
or Err(_)
is returned the connection is
considered closed and no further invocation of this method
must be attempted.
Cancellation
Please note that if you poll the returned Future
it must
not be cancelled but polled until Poll::Ready
is returned.
Trait Implementations
sourceimpl<T> Debug for Connection<T>
impl<T> Debug for Connection<T>
sourceimpl<T> Display for Connection<T>
impl<T> Display for Connection<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for Connection<T>
impl<T> Send for Connection<T> where
T: Send,
impl<T> Sync for Connection<T> where
T: Sync,
impl<T> Unpin for Connection<T> where
T: Unpin,
impl<T> !UnwindSafe for Connection<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more