pub struct Control { /* private fields */ }
Expand description
The Yamux Connection
controller.
While a Yamux connection makes progress via its next_stream
method,
this controller can be used to concurrently direct the connection,
e.g. to open a new stream to the remote or to close the connection.
The possible operations are implemented as async methods and redundantly as poll-based variants which may be useful inside of other poll based environments such as certain trait implementations.
Implementations§
source§impl Control
impl Control
sourcepub async fn open_stream(&mut self) -> Result<Stream, ConnectionError>
pub async fn open_stream(&mut self) -> Result<Stream, ConnectionError>
Open a new stream to the remote.
sourcepub async fn close(&mut self) -> Result<(), ConnectionError>
pub async fn close(&mut self) -> Result<(), ConnectionError>
Close the connection.
sourcepub fn poll_open_stream(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<Stream, ConnectionError>>
pub fn poll_open_stream( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<Stream, ConnectionError>>
Poll
based alternative to Control::open_stream
.
sourcepub fn abort_open_stream(&mut self)
pub fn abort_open_stream(&mut self)
Abort an ongoing open stream operation started by poll_open_stream
.
sourcepub fn poll_close(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<(), ConnectionError>>
pub fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<(), ConnectionError>>
Poll
based alternative to Control::close
.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Control
impl Send for Control
impl Sync for Control
impl Unpin for Control
impl !UnwindSafe for Control
Blanket Implementations§
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