pub struct BufReader<R> { /* private fields */ }
Expand description
BufReader is a struct with a buffer. BufReader implements AsyncBufRead and AsyncReadRent, and if the inner io implements AsyncWriteRent, it will delegate the implementation.
Implementations
sourceimpl<R> BufReader<R>
impl<R> BufReader<R>
sourcepub fn with_capacity(capacity: usize, inner: R) -> Self
pub fn with_capacity(capacity: usize, inner: R) -> Self
Create BufReader with given buffer size
sourcepub fn get_ref(&self) -> &R
pub fn get_ref(&self) -> &R
Gets a reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Consumes this BufReader
, returning the underlying reader.
Note that any leftover data in the internal buffer is lost.
Trait Implementations
sourceimpl<R: AsyncReadRent> AsyncBufRead for BufReader<R>
impl<R: AsyncReadRent> AsyncBufRead for BufReader<R>
sourceimpl<R: AsyncReadRent> AsyncReadRent for BufReader<R>
impl<R: AsyncReadRent> AsyncReadRent for BufReader<R>
type ReadFuture<'a, T>
where
T: IoBufMut + 'a,
R: 'a = impl Future<Output = (Result<usize, Error>, T)> + 'a
type ReadFuture<'a, T>
where
T: IoBufMut + 'a,
R: 'a = impl Future<Output = (Result<usize, Error>, T)> + 'a
The future of read Result<size, buffer>
type ReadvFuture<'a, T>
where
T: IoVecBufMut + 'a,
R: 'a = impl Future<Output = (Result<usize, Error>, T)> + 'a
type ReadvFuture<'a, T>
where
T: IoVecBufMut + 'a,
R: 'a = impl Future<Output = (Result<usize, Error>, T)> + 'a
The future of readv Result<size, buffer>
sourcefn read<T: IoBufMut>(&mut self, buf: T) -> Self::ReadFuture<'_, T>
fn read<T: IoBufMut>(&mut self, buf: T) -> Self::ReadFuture<'_, T>
Same as read(2)
sourcefn readv<T: IoVecBufMut>(&mut self, buf: T) -> Self::ReadvFuture<'_, T>
fn readv<T: IoVecBufMut>(&mut self, buf: T) -> Self::ReadvFuture<'_, T>
Same as readv(2)
sourceimpl<R: AsyncReadRent + AsyncWriteRent> AsyncWriteRent for BufReader<R>
impl<R: AsyncReadRent + AsyncWriteRent> AsyncWriteRent for BufReader<R>
type WriteFuture<'a, T>
where
T: IoBuf + 'a,
R: 'a = <R as AsyncWriteRent>::WriteFuture<'a, T>
type WriteFuture<'a, T>
where
T: IoBuf + 'a,
R: 'a = <R as AsyncWriteRent>::WriteFuture<'a, T>
The future of write Result<size, buffer>
type WritevFuture<'a, T>
where
T: IoVecBuf + 'a,
R: 'a = <R as AsyncWriteRent>::WritevFuture<'a, T>
type WritevFuture<'a, T>
where
T: IoVecBuf + 'a,
R: 'a = <R as AsyncWriteRent>::WritevFuture<'a, T>
The future of writev Result<size, buffer>
type FlushFuture<'a>
where
R: 'a = <R as AsyncWriteRent>::FlushFuture<'a>
type FlushFuture<'a>
where
R: 'a = <R as AsyncWriteRent>::FlushFuture<'a>
The future of flush
type ShutdownFuture<'a>
where
R: 'a = <R as AsyncWriteRent>::ShutdownFuture<'a>
type ShutdownFuture<'a>
where
R: 'a = <R as AsyncWriteRent>::ShutdownFuture<'a>
The future of shutdown
sourcefn write<T: IoBuf>(&mut self, buf: T) -> Self::WriteFuture<'_, T>
fn write<T: IoBuf>(&mut self, buf: T) -> Self::WriteFuture<'_, T>
Same as write(2)
sourcefn writev<T: IoVecBuf>(&mut self, buf_vec: T) -> Self::WritevFuture<'_, T>
fn writev<T: IoVecBuf>(&mut self, buf_vec: T) -> Self::WritevFuture<'_, T>
Same as writev(2)
sourcefn flush(&mut self) -> Self::FlushFuture<'_>
fn flush(&mut self) -> Self::FlushFuture<'_>
Flush buffered data if needed
sourcefn shutdown(&mut self) -> Self::ShutdownFuture<'_>
fn shutdown(&mut self) -> Self::ShutdownFuture<'_>
Same as shutdown
Auto Trait Implementations
impl<R> RefUnwindSafe for BufReader<R>where
R: RefUnwindSafe,
impl<R> Send for BufReader<R>where
R: Send,
impl<R> Sync for BufReader<R>where
R: Sync,
impl<R> Unpin for BufReader<R>where
R: Unpin,
impl<R> UnwindSafe for BufReader<R>where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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