Skip to main content

Store

Struct Store 

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

An opened artifact.

Implementations§

Source§

impl Store

Source

pub fn open(path: &Path) -> Result<Self, StoreError>

Opens the artifact at path read-only and checks its layout version.

§Errors

Returns StoreError when the file cannot be opened, is not an artifact of this layout, or a table is missing.

Source

pub fn path(&self) -> &Path

The artifact’s path.

Source

pub fn meta(&self, key: &str) -> Result<Option<String>, StoreError>

An artifact-level fact by key.

§Errors

Returns StoreError when the database cannot be read.

Source

pub fn ordinal(&self, code: &str) -> Result<Option<Ordinal>, StoreError>

The ordinal of a native code, if the version has it.

§Errors

Returns StoreError when the database cannot be read.

Source

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

The concept at ordinal, if any.

§Errors

Returns StoreError when the database cannot be read or the record is damaged.

Source

pub fn code(&self, ordinal: Ordinal) -> Result<Option<&str>, StoreError>

The native code at ordinal, borrowed from the column.

The code is the first field of the record, so this reads one length and one string and copies nothing.

§Errors

Returns StoreError when the code is damaged.

Source

pub fn concepts( &self, ordinals: impl IntoIterator<Item = Ordinal>, ) -> Result<Vec<Option<Concept>>, StoreError>

The concepts at ordinals, in the order given, None where the store has no such concept.

§Errors

Returns StoreError when a record is damaged.

Source

pub fn codes( &self, ordinals: impl IntoIterator<Item = Ordinal>, ) -> Result<Vec<Option<String>>, StoreError>

The native codes at ordinals, in the order given, None where the store has no such concept.

Each code is sliced out of the concept column and decoded only as far as its code, so the batch costs one string per code and nothing else. A caller that can borrow calls Self::code and pays not even that.

§Errors

Returns StoreError when a code is damaged.

Source

pub fn designations( &self, ordinal: Ordinal, ) -> Result<Vec<Designation>, StoreError>

Every designation of ordinal, in index order.

§Errors

Returns StoreError when the database cannot be read or a record is damaged.

Source

pub fn acceptability( &self, ordinal: Ordinal, designation: u32, language_refset: u32, ) -> Result<Option<u32>, StoreError>

The acceptability ordinal of a designation in a language reference set.

§Errors

Returns StoreError when the column is damaged.

Source

pub fn preferred( &self, ordinal: Ordinal, language_refset: u32, use_ordinal: u32, ) -> Result<Option<Designation>, StoreError>

The preferred designation of ordinal for a language reference set and designation use: the lowest-indexed designation of that use the reference set marks preferred.

§Errors

Returns StoreError when the database cannot be read or a record is damaged.

Source

pub fn display( &self, ordinal: Ordinal, language_refsets: impl IntoIterator<Item = u32>, accept: impl Fn(&str) -> bool, ) -> Result<Option<String>, StoreError>

The display of ordinal from the first of language_refsets whose language accept admits.

The build chose one display per reference set, so this reads the column and stops at the first language the caller wants; no table is touched. The reference sets are asked in the order given, which is what decides the answer when several carry the same language.

§Errors

Returns StoreError when the column is damaged.

Source

pub fn properties( &self, ordinal: Ordinal, ) -> Result<Vec<(u32, Vec<PropertyValue>)>, StoreError>

Every property of ordinal, as (property key ordinal, values), in key order.

§Errors

Returns StoreError when the column is damaged.

Source

pub fn vocabulary( &self, kind: Vocabulary, ordinal: u32, ) -> Result<Option<String>, StoreError>

A vocabulary entry: the name of a property key, designation use, language reference set, or acceptability ordinal.

§Errors

Returns StoreError when the database cannot be read.

Source

pub fn vocabulary_ordinal( &self, kind: Vocabulary, name: &str, ) -> Result<Option<u32>, StoreError>

The ordinal of a vocabulary name, by scanning the (small) vocabulary table.

§Errors

Returns StoreError when the database cannot be read.

Trait Implementations§

Source§

impl Debug for Store

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Store

§

impl !UnwindSafe for Store

§

impl Freeze for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

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.