pub struct BufWriter<W: ?Sized + Write> { /* private fields */ }Expand description
Wraps a writer and buffers its output.
See std::io::BufWriter for more details.
Implementations§
Source§impl<W: Write> BufWriter<W>
impl<W: Write> BufWriter<W>
Sourcepub fn new(inner: W) -> BufWriter<W>
pub fn new(inner: W) -> BufWriter<W>
Creates a new BufWriter<W> with a default buffer capacity.
Sourcepub fn into_inner(self) -> Result<W, IntoInnerError<BufWriter<W>>>
pub fn into_inner(self) -> Result<W, IntoInnerError<BufWriter<W>>>
Sourcepub fn into_parts(
self,
) -> (W, Result<Vec<u8, DEFAULT_BUF_SIZE, u16>, WriterPanicked>)
pub fn into_parts( self, ) -> (W, Result<Vec<u8, DEFAULT_BUF_SIZE, u16>, WriterPanicked>)
Disassembles this BufWriter<W>, returning the underlying writer, and any buffered but
unwritten data.
If the underlying writer panicked, it is not known what portion of the data was written.
In this case, we return WriterPanicked for the buffered data (from which the buffer
contents can still be recovered).
into_parts makes no attempt to flush data and cannot fail.
Trait Implementations§
Source§impl<W: ?Sized + Write + Seek> Seek for BufWriter<W>
impl<W: ?Sized + Write + Seek> Seek for BufWriter<W>
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to the offset, in bytes, in the underlying writer.
Seeking always writes out the internal buffer before seeking.
Source§fn stream_position(&mut self) -> Result<u64>
fn stream_position(&mut self) -> Result<u64>
Returns the current seek position from the start of the stream. Read more
Source§fn stream_len(&mut self) -> Result<u64>
fn stream_len(&mut self) -> Result<u64>
Returns the length of this stream (in bytes).
Source§impl<W: ?Sized + Write> Write for BufWriter<W>
impl<W: ?Sized + Write> Write for BufWriter<W>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written.
Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer.
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination.
Auto Trait Implementations§
impl<W> Freeze for BufWriter<W>
impl<W> RefUnwindSafe for BufWriter<W>where
W: RefUnwindSafe + ?Sized,
impl<W> Send for BufWriter<W>
impl<W> Sync for BufWriter<W>
impl<W> Unpin for BufWriter<W>
impl<W> UnsafeUnpin for BufWriter<W>where
W: UnsafeUnpin + ?Sized,
impl<W> UnwindSafe for BufWriter<W>where
W: UnwindSafe + ?Sized,
Blanket Implementations§
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