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§
Trait Implementations§
source§impl<IO> BlockIo for Writer<IO>where
IO: BlockIo,
impl<IO> BlockIo for Writer<IO>where
IO: BlockIo,
source§fn block_size(&self) -> usize
fn block_size(&self) -> usize
Returns the size in bytes of a single block (i.e., sector),
the minimum granularity of I/O transfers.
source§impl<IO> BlockWriter for Writer<IO>where
IO: BlockWriter,
impl<IO> BlockWriter for Writer<IO>where
IO: BlockWriter,
source§impl<IO> ByteWriter for Writer<IO>where
IO: ByteWriter,
impl<IO> ByteWriter for Writer<IO>where
IO: ByteWriter,
source§impl<IO> KnownLength for Writer<IO>where
IO: KnownLength,
impl<IO> KnownLength for Writer<IO>where
IO: KnownLength,
source§impl<IO> Seek for Writer<IO>where
IO: KnownLength,
impl<IO> Seek for Writer<IO>where
IO: KnownLength,
source§fn seek(&mut self, position: SeekFrom) -> Result<u64>
fn seek(&mut self, position: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
Returns the length of this stream (in bytes). Read more
§fn stream_position(&mut self) -> Result<u64, Error>
fn stream_position(&mut self) -> Result<u64, Error>
Returns the current seek position from the start of the stream. Read more
source§impl<IO> Write for Writer<IO>where
IO: ByteWriter,
impl<IO> Write for Writer<IO>where
IO: ByteWriter,
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. Read more
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more