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
.