Struct chronicle::queue::BytesReader
#[repr(C)]pub struct BytesReader { /* private fields */ }
Expand description
A BytesReader
enables a reader to directly access bytes within a reserved section written by a BytesWriter.
In some cases this can result in reduced read latency by eliminating a copy.
It also enables Queue to be directly integrated with components which read directly from a region of memory.
Example
let tailer = queue.create_tailer().unwrap();
{
let reader = tailer.scoped_bytes_reader();
if !reader.is_empty() {
let slice = reader.as_slice();
...
// directly read from the slice (which reads directly from the Queue)
...
}
}
Implementations§
§impl BytesReader
impl BytesReader
§impl BytesReader
impl BytesReader
§impl BytesReader
impl BytesReader
pub fn rollback_on_close(&self)
pub fn rollback_on_close(&self)
Set this BytesReader
to rollback when closed (either explicitly by calling close()
, or automatically
when using a scoped reader). Rolling back leaves the reader in the same state and read position as
before the read was attempted