pub struct BufWriter<W> { /* private fields */ }
Expand description
BufWriter is a struct with a buffer. BufWriter implements AsyncWriteRent, and if the inner io implements AsyncReadRent, it will delegate the implementation.
Implementations§
Source§impl<W> BufWriter<W>
impl<W> BufWriter<W>
Sourcepub fn with_capacity(capacity: usize, inner: W) -> Self
pub fn with_capacity(capacity: usize, inner: W) -> Self
Create BufWriter with given buffer size
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes this BufWriter
, returning the underlying writer.
Note that any leftover data in the internal buffer is lost.
Trait Implementations§
Source§impl<W: AsyncWriteRent + AsyncBufRead> AsyncBufRead for BufWriter<W>
impl<W: AsyncWriteRent + AsyncBufRead> AsyncBufRead for BufWriter<W>
Source§impl<W: AsyncWriteRent + AsyncReadRent> AsyncReadRent for BufWriter<W>
impl<W: AsyncWriteRent + AsyncReadRent> AsyncReadRent for BufWriter<W>
Source§impl<W: AsyncWriteRent> AsyncWriteRent for BufWriter<W>
impl<W: AsyncWriteRent> AsyncWriteRent for BufWriter<W>
Source§async fn write<T: IoBuf>(&mut self, buf: T) -> BufResult<usize, T>
async fn write<T: IoBuf>(&mut self, buf: T) -> BufResult<usize, T>
Writes the contents of a buffer into this writer, returning the number of bytes written. Read more
Source§async fn writev<T: IoVecBuf>(&mut self, buf: T) -> BufResult<usize, T>
async fn writev<T: IoVecBuf>(&mut self, buf: T) -> BufResult<usize, T>
This function attempts to write the entire contents of
buf_vec
, but the write may not
fully succeed, and it might also result in an error. The bytes will be written starting at
the specified offset. Read moreAuto Trait Implementations§
impl<W> Freeze for BufWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for BufWriter<W>where
W: RefUnwindSafe,
impl<W> Send for BufWriter<W>where
W: Send,
impl<W> Sync for BufWriter<W>where
W: Sync,
impl<W> Unpin for BufWriter<W>where
W: Unpin,
impl<W> UnwindSafe for BufWriter<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<A> AsyncBufReadExt for Awhere
A: AsyncBufRead + ?Sized,
impl<A> AsyncBufReadExt for Awhere
A: AsyncBufRead + ?Sized,
Source§fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> impl Future<Output = Result<usize, Error>>
fn read_until<'a>( &'a mut self, byte: u8, buf: &'a mut Vec<u8>, ) -> impl Future<Output = Result<usize, Error>>
This function will read bytes from the underlying stream until the delimiter or EOF is
found. Once found, all bytes up to, and including, the delimiter (if found) will be appended
to buf. Read more
Source§async fn read_line<'a>(
&'a mut self,
buf: &'a mut String,
) -> Result<usize, Error>
async fn read_line<'a>( &'a mut self, buf: &'a mut String, ) -> Result<usize, Error>
This function will read bytes from the underlying stream until the newline delimiter (the
0xA byte) or EOF is found. Once found, all bytes up to, and including, the delimiter (if
found) will be appended to buf. Read more
Source§impl<A> AsyncReadRentExt for Awhere
A: AsyncReadRent + ?Sized,
impl<A> AsyncReadRentExt for Awhere
A: AsyncReadRent + ?Sized,
Source§async fn read_exact<T>(&mut self, buf: T) -> (Result<usize, Error>, T)where
T: IoBufMut + 'static,
async fn read_exact<T>(&mut self, buf: T) -> (Result<usize, Error>, T)where
T: IoBufMut + 'static,
Read until buf capacity is fulfilled
Source§async fn read_vectored_exact<T>(&mut self, buf: T) -> (Result<usize, Error>, T)where
T: IoVecBufMut + 'static,
async fn read_vectored_exact<T>(&mut self, buf: T) -> (Result<usize, Error>, T)where
T: IoVecBufMut + 'static,
Readv until buf capacity is fulfilled
Source§impl<A> AsyncWriteRentExt for Awhere
A: AsyncWriteRent + ?Sized,
impl<A> AsyncWriteRentExt for Awhere
A: AsyncWriteRent + ?Sized,
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