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
sourceimpl 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
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more