Skip to main content

SegWriter

Struct SegWriter 

Source
pub struct SegWriter { /* private fields */ }
Expand description

Builds a seg .kv file from a sequence of words.

Implementations§

Source§

impl SegWriter

Source

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.

Source

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.

Source

pub fn add_word(&mut self, word: &[u8]) -> Result<()>

Append one word. Words are emitted in the order added.

Source

pub fn words_count(&self) -> u64

Number of words added so far.

Source

pub fn finish(self) -> Result<()>

Finalize: write kv_path and remove the temporary file.

Trait Implementations§

Source§

impl Drop for SegWriter

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.