Struct BufStream

struct BufStream<RW> { ... }

Wraps a type that is AsyncWrite and AsyncRead, and buffers its input and output.

It can be excessively inefficient to work directly with something that implements AsyncWrite and AsyncRead. For example, every write, however small, has to traverse the syscall interface, and similarly, every read has to do the same. The BufWriter and BufReader types aid with these problems respectively, but do so in only one direction. BufStream wraps one in the other so that both directions are buffered. See their documentation for details.

Implementations

impl<RW: AsyncRead + AsyncWrite> BufStream<RW>

fn new(stream: RW) -> BufStream<RW>

Wraps a type in both BufWriter and BufReader.

See the documentation for those types and BufStream for details.

fn with_capacity(reader_capacity: usize, writer_capacity: usize, stream: RW) -> BufStream<RW>

Creates a BufStream with the specified BufReader capacity and BufWriter capacity.

See the documentation for those types and BufStream for details.

fn get_ref(self: &Self) -> &RW

Gets a reference to the underlying I/O object.

It is inadvisable to directly read from the underlying I/O object.

fn get_mut(self: &mut Self) -> &mut RW

Gets a mutable reference to the underlying I/O object.

It is inadvisable to directly read from the underlying I/O object.

fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut RW>

Gets a pinned mutable reference to the underlying I/O object.

It is inadvisable to directly read from the underlying I/O object.

fn into_inner(self: Self) -> RW

Consumes this BufStream, returning the underlying I/O object.

Note that any leftover data in the internal buffer is lost.

impl<'__pin, RW> Unpin for BufStream<RW>

impl<R> AsyncBufReadExt for BufStream<RW>

impl<R> AsyncReadExt for BufStream<RW>

impl<RW> Freeze for BufStream<RW>

impl<RW> From for BufStream<RW>

fn from(b: BufReader<BufWriter<RW>>) -> Self

impl<RW> From for BufStream<RW>

fn from(b: BufWriter<BufReader<RW>>) -> Self

impl<RW> RefUnwindSafe for BufStream<RW>

impl<RW> Send for BufStream<RW>

impl<RW> Sync for BufStream<RW>

impl<RW> UnsafeUnpin for BufStream<RW>

impl<RW> UnwindSafe for BufStream<RW>

impl<RW: $crate::fmt::Debug> Debug for BufStream<RW>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<RW: AsyncRead + AsyncWrite + AsyncSeek> AsyncSeek for BufStream<RW>

fn start_seek(self: Pin<&mut Self>, position: SeekFrom) -> Result<()>
fn poll_complete(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<u64>>

impl<RW: AsyncRead + AsyncWrite> AsyncBufRead for BufStream<RW>

fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<&[u8]>>
fn consume(self: Pin<&mut Self>, amt: usize)

impl<RW: AsyncRead + AsyncWrite> AsyncRead for BufStream<RW>

fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<Result<()>>

impl<RW: AsyncRead + AsyncWrite> AsyncWrite for BufStream<RW>

fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize>>
fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize>>
fn is_write_vectored(self: &Self) -> bool
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

impl<S> AsyncSeekExt for BufStream<RW>

impl<T> Any for BufStream<RW>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for BufStream<RW>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for BufStream<RW>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for BufStream<RW>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for BufStream<RW>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for BufStream<RW>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for BufStream<RW>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<W> AsyncWriteExt for BufStream<RW>