pub struct Duplex<R, W> { /* private fields */ }Expand description
Implements both AsyncRead and AsyncWrite by delegating to an AsyncRead and an AsyncWrite, taking ownership of both.
Implementations§
Source§impl<R, W> Duplex<R, W>
impl<R, W> Duplex<R, W>
Sourcepub fn new(r: R, w: W) -> Duplex<R, W>
pub fn new(r: R, w: W) -> Duplex<R, W>
Takes ownership of a reader and a writer and creates a new Duplex.
Sourcepub fn get_reader_ref(&self) -> &R
pub fn get_reader_ref(&self) -> &R
Gets a reference to the underlying reader.
Sourcepub fn get_reader_mut(&mut self) -> &mut R
pub fn get_reader_mut(&mut self) -> &mut R
Gets a mutable reference to the underlying reader.
Sourcepub fn get_writer_ref(&self) -> &W
pub fn get_writer_ref(&self) -> &W
Gets a reference to the underlying writer.
Sourcepub fn get_writer_mut(&mut self) -> &mut W
pub fn get_writer_mut(&mut self) -> &mut W
Gets a mutable reference to the underlying writer.
Sourcepub fn into_inner(self) -> (R, W)
pub fn into_inner(self) -> (R, W)
Unwraps this Duplex, returning the underlying reader and writer.
Trait Implementations§
Source§impl<R: AsyncRead, W> AsyncRead for Duplex<R, W>
impl<R: AsyncRead, W> AsyncRead for Duplex<R, W>
Source§impl<R, W: AsyncWrite> AsyncWrite for Duplex<R, W>
impl<R, W: AsyncWrite> AsyncWrite for Duplex<R, W>
Source§fn poll_write(&mut self, cx: &mut Context<'_>, buf: &[u8]) -> Poll<usize, Error>
fn poll_write(&mut self, cx: &mut Context<'_>, buf: &[u8]) -> Poll<usize, Error>
Attempt to write bytes from
buf into the object. Read moreSource§fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<(), Error>
fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<(), Error>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
impl<R: Copy, W: Copy> Copy for Duplex<R, W>
impl<R: Eq, W: Eq> Eq for Duplex<R, W>
impl<R, W> StructuralPartialEq for Duplex<R, W>
Auto Trait Implementations§
impl<R, W> Freeze for Duplex<R, W>
impl<R, W> RefUnwindSafe for Duplex<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for Duplex<R, W>
impl<R, W> Sync for Duplex<R, W>
impl<R, W> Unpin for Duplex<R, W>
impl<R, W> UnwindSafe for Duplex<R, W>where
R: UnwindSafe,
W: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more