Struct io::Writer

source · []
pub struct Writer<W>(_);
Expand description

A stateful writer that keeps track of its current offset within the internal stateless ByteWriter I/O stream.

This implements the [core2::io::Write] trait for write-only access, as well as the [core2::io::Seek] trait if the underlying I/O stream implements KnownLength. It also forwards all other write-only I/O-related traits implemented by the underlying I/O stream.

Note: this is implemented as a thin wrapper around ReaderWriter.

Implementations

Creates a new Writer with an initial offset of 0.

Trait Implementations

Returns the size in bytes of a single block (i.e., sector), the minimum granularity of I/O transfers. Read more

Writes blocks of data from the given buffer to this writer. Read more

Flushes this entire writer’s output stream, ensuring all contents in intermediate buffers are fully written out. Read more

Writes bytes of data from the given buffer to this writer. Read more

Flushes this writer’s output stream, ensuring all contents in intermediate buffers are fully written out. Read more

Returns the length (size in bytes) of this I/O stream or device.

Seek to an offset, in bytes, in a stream. Read more

Rewind to the beginning of a stream. Read more

Returns the length of this stream (in bytes). Read more

Returns the current seek position from the start of the stream. Read more

Write a buffer into this writer, 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 writer. 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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.