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
BufWriterandBufReader.See the documentation for those types and
BufStreamfor details.fn with_capacity(reader_capacity: usize, writer_capacity: usize, stream: RW) -> BufStream<RW>Creates a
BufStreamwith the specifiedBufReadercapacity andBufWritercapacity.See the documentation for those types and
BufStreamfor details.fn get_ref(self: &Self) -> &RWGets 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 RWGets 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) -> RWConsumes 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) -> boolfn 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) -> TReturns the argument unchanged.
impl<T, U> Into for BufStream<RW>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses 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>