Skip to main content

StoreBuilder

Struct StoreBuilder 

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

An artifact under construction.

Rows are buffered in memory, sorted by key, and written in finish, each table opened once. redb fills pages tightly when keys arrive in order, and opening a table is not free; the first build wrote every row through its own open_table in arrival order and took ten minutes for the NL edition.

Implementations§

Source§

impl StoreBuilder

Source

pub fn create( path: &Path, system: &str, version: &str, ) -> Result<Self, BuildError>

Creates the artifact at path, replacing any file there, and records the layout version, system, and version.

§Errors

Returns BuildError when the file cannot be created.

Source

pub fn vocabulary( &mut self, kind: Vocabulary, ordinal: u32, name: &str, ) -> Result<(), BuildError>

Names a vocabulary ordinal (a property key, designation use, language reference set, or acceptability).

§Errors

Returns BuildError::Vocabulary when name already has another ordinal.

Source

pub fn concept( &mut self, ordinal: Ordinal, concept: &Concept, ) -> Result<(), BuildError>

Adds a concept under ordinal.

§Errors

Cannot fail today; the signature keeps the door open for a full buffer.

Source

pub fn designation( &mut self, ordinal: Ordinal, index: u32, designation: &Designation, ) -> Result<(), BuildError>

Adds designation index of concept ordinal.

§Errors

Cannot fail today; the signature keeps the door open for a full buffer.

Source

pub fn acceptability( &mut self, ordinal: Ordinal, index: u32, language_refset: u32, acceptability: u32, ) -> Result<(), BuildError>

Records the acceptability of a designation in a language reference set.

§Errors

Cannot fail today; the signature keeps the door open for a full buffer.

Source

pub fn properties( &mut self, ordinal: Ordinal, key: u32, values: &[PropertyValue], ) -> Result<(), BuildError>

Sets the values of property key on concept ordinal.

§Errors

Cannot fail today; the signature keeps the door open for a full buffer.

Source

pub fn finish(self, rule: &PreferredRule) -> Result<PathBuf, BuildError>

Writes every buffered row in key order, computes the preferred designations per language reference set and use, records the concept count, and commits.

§Errors

Returns BuildError when a table cannot be written or the commit fails.

Trait Implementations§

Source§

impl Debug for StoreBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.