Struct obkv::KvWriter [−][src]
pub struct KvWriter<W, K> { /* fields omitted */ }
Expand description
An obkv
database writer.
Implementations
Creates an in memory KvWriter
that writes the bytes into a Vec<u8>
.
use obkv::KvWriterU16; let mut writer = KvWriterU16::memory(); writer.insert(0, b"hello").unwrap(); writer.insert(1, b"blue").unwrap(); writer.insert(255, b"world").unwrap(); let vec = writer.into_inner().unwrap();
Creates a KvWriter
that writes the bytes into
the given io::Write
type (e.g. File
, Vec<u8>
).
use obkv::KvWriterU16; let mut writer = KvWriterU16::new(Vec::new()); writer.insert(0, b"hello").unwrap(); writer.insert(1, b"blue").unwrap(); writer.insert(255, b"world").unwrap(); let vec = writer.into_inner().unwrap();
Insert a key value pair into the database, keys must be inserted in order and must be inserted only one time.
use obkv::KvWriterU16; let mut writer = KvWriterU16::new(Vec::new()); writer.insert(0, b"hello").unwrap(); writer.insert(1, b"blue").unwrap(); writer.insert(255, b"world").unwrap(); let vec = writer.into_inner().unwrap();
Insert the key value pairs into the database, keys must be inserted in order and must be inserted only one time.
Flushes then extract the internal writer that now contains the keys value entries.
Trait Implementations
Auto Trait Implementations
impl<W, K> RefUnwindSafe for KvWriter<W, K> where
K: RefUnwindSafe,
W: RefUnwindSafe,
impl<W, K> UnwindSafe for KvWriter<W, K> where
K: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more