pub struct SegWriter { /* private fields */ }Expand description
Builds a seg .kv file from a sequence of words.
Implementations§
Source§impl SegWriter
impl SegWriter
Sourcepub fn create(kv_path: impl AsRef<Path>) -> Result<SegWriter>
pub fn create(kv_path: impl AsRef<Path>) -> Result<SegWriter>
Create a writer that will produce kv_path (no pattern compression). A sibling
temporary file (<kv_path>.words.tmp) holds buffered words until
finish.
Sourcepub fn create_with(
kv_path: impl AsRef<Path>,
compress: bool,
) -> Result<SegWriter>
pub fn create_with( kv_path: impl AsRef<Path>, compress: bool, ) -> Result<SegWriter>
Like create but choosing whether to pattern-compress the
output. Compression produces a smaller, still erigon-readable file at the cost of
extra passes over the buffered words.
Sourcepub fn add_word(&mut self, word: &[u8]) -> Result<()>
pub fn add_word(&mut self, word: &[u8]) -> Result<()>
Append one word. Words are emitted in the order added.
Sourcepub fn words_count(&self) -> u64
pub fn words_count(&self) -> u64
Number of words added so far.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SegWriter
impl RefUnwindSafe for SegWriter
impl Send for SegWriter
impl Sync for SegWriter
impl Unpin for SegWriter
impl UnsafeUnpin for SegWriter
impl UnwindSafe for SegWriter
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