[−][src]Trait genio::bufio::BufWrite
When writing, it might be better to serialize directly into a buffer. This trait allows such situation.
This triat is unsafe
because it optimizes buffers to not require zeroing.
Required methods
fn request_buffer(&mut self) -> Result<*mut [u8], Self::WriteError>
Requests buffer for writing. The buffer is represented as a pointer because it may contain uninitialized memory - only writing is allowed. The pointer must not outlive Self!
The returned slice must always be non-empty. If non-emty slice can't be returned, Err
must
be returned instead. If the underlying writer is full, it has to flush the buffer.
unsafe fn submit_buffer(&mut self, size: usize)
Tells the buf writer that size
bytes were written into buffer.
The size
must NOT be bigger by mistake!
Provided methods
fn write_byte(&mut self, byte: u8) -> Result<(), Self::WriteError>
Writes single byte. Since this is buffered, the operation will be efficient.