pub struct Duplex<R, W> { /* private fields */ }
Expand description
Combine a reader + writer into a duplex of Read
+ Write
.
Implementations
Trait Implementations
sourceimpl<R: BufRead, W> AsyncBufRead for Duplex<R, W>
impl<R: BufRead, W> AsyncBufRead for Duplex<R, W>
sourceimpl<R: Read, W> AsyncRead for Duplex<R, W>
impl<R: Read, W> AsyncRead for Duplex<R, W>
sourceimpl<R, W: Write> AsyncWrite for Duplex<R, W>
impl<R, W: Write> AsyncWrite for Duplex<R, W>
sourcefn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
Attempt to write bytes from buf
into the object. Read more
sourcefn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
impl<'__pin, R, W> Unpin for Duplex<R, W> where
__Origin<'__pin, R, W>: Unpin,
Auto Trait Implementations
impl<R, W> RefUnwindSafe for Duplex<R, W> where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for Duplex<R, W> where
R: Send,
W: Send,
impl<R, W> Sync for Duplex<R, W> where
R: Sync,
W: Sync,
impl<R, W> UnwindSafe for Duplex<R, W> where
R: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
sourceimpl<R> AsyncBufReadExt for R where
R: AsyncBufRead + ?Sized,
impl<R> AsyncBufReadExt for R where
R: AsyncBufRead + ?Sized,
sourcefn fill_buf(&mut self) -> FillBuf<'_, Self> where
Self: Unpin,
fn fill_buf(&mut self) -> FillBuf<'_, Self> where
Self: Unpin,
Returns the contents of the internal buffer, filling it with more data if empty. Read more
sourcefn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8, Global>
) -> ReadUntilFuture<'a, Self> where
Self: Unpin,
fn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8, Global>
) -> ReadUntilFuture<'a, Self> where
Self: Unpin,
Reads all bytes and appends them into buf
until the delimiter byte
or EOF is found. Read more
sourcefn read_line(&'a mut self, buf: &'a mut String) -> ReadLineFuture<'a, Self> where
Self: Unpin,
fn read_line(&'a mut self, buf: &'a mut String) -> ReadLineFuture<'a, Self> where
Self: Unpin,
Reads all bytes and appends them into buf
until a newline (the 0xA byte) or EOF is found. Read more
sourceimpl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
sourcefn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
Reads some bytes from the byte stream. Read more
sourcefn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
sourcefn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
sourcefn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
sourcefn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
Reads the exact number of bytes required to fill buf
. Read more
sourcefn take(self, limit: u64) -> Take<Self>
fn take(self, limit: u64) -> Take<Self>
Creates an adapter which will read at most limit
bytes from it. Read more
sourceimpl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
sourcefn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
Writes some bytes into the byte stream. Read more
sourcefn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
sourcefn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
Self: Unpin,
Writes an entire buffer into the byte stream. Read more
sourcefn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
Flushes the stream to ensure that all buffered contents reach their destination. Read more
sourcefn close(&mut self) -> CloseFuture<'_, Self> where
Self: Unpin,
fn close(&mut self) -> CloseFuture<'_, Self> where
Self: Unpin,
Closes the writer. Read more
sourcefn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a, Global>> where
Self: 'a + Send,
fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a, Global>> where
Self: 'a + Send,
Boxes the writer and changes its type to dyn AsyncWrite + Send + 'a
. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> BufReadExt for T where
T: AsyncBufRead + ?Sized,
impl<T> BufReadExt for T where
T: AsyncBufRead + ?Sized,
sourcefn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8, Global>
) -> ReadUntilFuture<'a, Self> where
Self: Unpin,
fn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8, Global>
) -> ReadUntilFuture<'a, Self> where
Self: Unpin,
Reads all bytes into buf
until the delimiter byte
or EOF is reached. Read more
sourcefn read_line(&'a mut self, buf: &'a mut String) -> ReadLineFuture<'a, Self> where
Self: Unpin,
fn read_line(&'a mut self, buf: &'a mut String) -> ReadLineFuture<'a, Self> where
Self: Unpin,
Reads all bytes and appends them into buf
until a newline (the 0xA byte) is
reached. Read more
sourceimpl<T> ReadExt for T where
T: AsyncRead + ?Sized,
impl<T> ReadExt for T where
T: AsyncRead + ?Sized,
sourcefn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
Reads some bytes from the byte stream. Read more
sourcefn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
sourcefn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
Reads all bytes from the byte stream. Read more
sourcefn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
Reads all bytes from the byte stream and appends them into a string. Read more
sourcefn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
Reads the exact number of bytes required to fill buf
. Read more
sourcefn take(self, limit: u64) -> Take<Self>
fn take(self, limit: u64) -> Take<Self>
Creates an adaptor which will read at most limit
bytes from it. Read more
sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read
. 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.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WriteExt for T where
T: AsyncWrite + ?Sized,
impl<T> WriteExt for T where
T: AsyncWrite + ?Sized,
sourcefn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
Writes some bytes into the byte stream. Read more
sourcefn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
Flushes the stream to ensure that all buffered contents reach their destination. Read more