pub struct Store { /* private fields */ }Expand description
An opened artifact.
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(path: &Path) -> Result<Self, StoreError>
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.
Sourcepub fn ordinal(&self, code: &str) -> Result<Option<Ordinal>, StoreError>
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.
Sourcepub fn concept(&self, ordinal: Ordinal) -> Result<Option<Concept>, StoreError>
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.
Sourcepub fn code(&self, ordinal: Ordinal) -> Result<Option<&str>, StoreError>
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.
Sourcepub fn concepts(
&self,
ordinals: impl IntoIterator<Item = Ordinal>,
) -> Result<Vec<Option<Concept>>, StoreError>
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.
Sourcepub fn codes(
&self,
ordinals: impl IntoIterator<Item = Ordinal>,
) -> Result<Vec<Option<String>>, StoreError>
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.
Sourcepub fn designations(
&self,
ordinal: Ordinal,
) -> Result<Vec<Designation>, StoreError>
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.
Sourcepub fn acceptability(
&self,
ordinal: Ordinal,
designation: u32,
language_refset: u32,
) -> Result<Option<u32>, StoreError>
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.
Sourcepub fn preferred(
&self,
ordinal: Ordinal,
language_refset: u32,
use_ordinal: u32,
) -> Result<Option<Designation>, StoreError>
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.
Sourcepub fn display(
&self,
ordinal: Ordinal,
language_refsets: impl IntoIterator<Item = u32>,
accept: impl Fn(&str) -> bool,
) -> Result<Option<String>, StoreError>
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.
Sourcepub fn properties(
&self,
ordinal: Ordinal,
) -> Result<Vec<(u32, Vec<PropertyValue>)>, StoreError>
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.
Sourcepub fn vocabulary(
&self,
kind: Vocabulary,
ordinal: u32,
) -> Result<Option<String>, StoreError>
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.
Sourcepub fn vocabulary_ordinal(
&self,
kind: Vocabulary,
name: &str,
) -> Result<Option<u32>, StoreError>
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.