pub struct Connection<T> { /* private fields */ }Expand description
A Yamux connection object.
Wraps the underlying I/O resource and makes progress via its
Connection::poll_next_inbound method which must be called repeatedly
until Ok(None) signals EOF or an error is encountered.
Implementations§
Source§impl<T> Connection<T>
impl<T> Connection<T>
pub fn new(socket: T, cfg: Config, mode: Mode) -> Connection<T>
Sourcepub fn poll_new_outbound(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Stream, ConnectionError>>
pub fn poll_new_outbound( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Stream, ConnectionError>>
Poll for a new outbound stream.
This function will fail if the current state does not allow opening new outbound streams.
Sourcepub fn poll_next_inbound(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Stream, ConnectionError>>>
pub fn poll_next_inbound( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<Stream, ConnectionError>>>
Poll for the next inbound stream.
If this function returns None, the underlying connection is closed.
Sourcepub fn poll_close(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), ConnectionError>>
pub fn poll_close( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), ConnectionError>>
Close the connection.
Trait Implementations§
Source§impl<T> Debug for Connection<T>where
T: Debug,
impl<T> Debug for Connection<T>where
T: Debug,
Auto Trait Implementations§
impl<T> !Freeze for Connection<T>
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§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more