Struct buf_redux::BufWriter [] [src]

pub struct BufWriter<W: Write, Fs: FlushStrategy = DefaultFlushStrategy> { /* fields omitted */ }

A drop-in replacement for std::io::BufWriter with more functionality.

Methods

impl<W: Write> BufWriter<W, DefaultFlushStrategy>
[src]

Wrap inner with the default buffer capacity and flush strategy.

Wrap inner with the given buffer capacity and the default flush strategy.

impl<W: Write, Fs: FlushStrategy> BufWriter<W, Fs>
[src]

Wrap inner with the default buffer capacity and given flush strategy

Wrap inner with the given buffer capacity and flush strategy.

Set a new FlushStrategy, returning the transformed type.

Mutate the current flush strategy.

Get a reference to the inner writer.

Get a mutable reference to the inner writer.

Note

If the buffer has not been flushed, writing directly to the inner type will cause data inconsistency.

Get the capacty of the inner buffer.

Get the number of bytes currently in the buffer.

Grow the internal buffer by at least additional bytes. May not be quite exact due to implementation details of the buffer's allocator.

Note

This should not be called frequently as each call will incur a reallocation.

Flush the buffer and unwrap, returning the inner writer on success, or a type wrapping self plus the error otherwise.

Flush the buffer and unwrap, returning the inner writer and any error encountered during flushing.

Consume self and return both the underlying writer and the buffer, with the data moved to the beginning and the length truncated to contain only valid data.

Trait Implementations

impl<W: Write, Fs: FlushStrategy> Write for BufWriter<W, Fs>
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

impl<W: Write + Seek, Fs: FlushStrategy> Seek for BufWriter<W, Fs>
[src]

Seek to the offset, in bytes, in the underlying writer.

Seeking always writes out the internal buffer before seeking.

impl<W: Debug + Write, Fs: FlushStrategy> Debug for BufWriter<W, Fs>
[src]

Formats the value using the given formatter.

impl<W: Write, Fs: FlushStrategy> Drop for BufWriter<W, Fs>
[src]

A method called when the value goes out of scope. Read more