pub struct ContainerWriter { /* private fields */ }👎Deprecated since 0.2.0:
superseded by the .verit file: use FileBuilder (in memory) or FileWriter (on disk). A .vertc container carries no schema section, so it cannot be read without an out-of-band registry. Removed in 0.3.0 — see ADR-0002.
Expand description
Build a .vertc container from a sequence of Veritate messages. The output
is a self-contained Vec<u8> you write to a file (and later mmap).
let mut w = ContainerWriter::new();
w.add(b"\x00message-a");
w.add(b"\x01message-b");
let file = w.finish();
let c = Container::parse(&file).unwrap();
assert_eq!(c.len(), 2);
assert_eq!(c.get(1).unwrap(), b"\x01message-b");Implementations§
Source§impl ContainerWriter
impl ContainerWriter
pub fn new() -> ContainerWriter
Sourcepub fn add(&mut self, message: &[u8]) -> &mut ContainerWriter
pub fn add(&mut self, message: &[u8]) -> &mut ContainerWriter
Append one message’s bytes as the next record. Records are stored in the order added and read back by that index.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Default for ContainerWriter
impl Default for ContainerWriter
Source§fn default() -> ContainerWriter
fn default() -> ContainerWriter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContainerWriter
impl RefUnwindSafe for ContainerWriter
impl Send for ContainerWriter
impl Sync for ContainerWriter
impl Unpin for ContainerWriter
impl UnsafeUnpin for ContainerWriter
impl UnwindSafe for ContainerWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more