pub struct CompiledCatalogIdIndex { /* private fields */ }Expand description
Stable compiled runtime ID index built from one or more normalized catalogs.
Implementations§
Source§impl CompiledCatalogIdIndex
impl CompiledCatalogIdIndex
Sourcepub fn new(
catalogs: &[&NormalizedParsedCatalog],
key_strategy: CompiledKeyStrategy,
) -> Result<CompiledCatalogIdIndex, ApiError>
pub fn new( catalogs: &[&NormalizedParsedCatalog], key_strategy: CompiledKeyStrategy, ) -> Result<CompiledCatalogIdIndex, ApiError>
Builds a deterministic compiled-ID index for the union of non-obsolete messages.
§Errors
Returns ApiError::Conflict when two different source identities compile to the same ID.
Sourcepub fn get(&self, compiled_id: &str) -> Option<&CatalogMessageKey>
pub fn get(&self, compiled_id: &str) -> Option<&CatalogMessageKey>
Returns the source key for compiled_id, if present.
Sourcepub fn contains_id(&self, compiled_id: &str) -> bool
pub fn contains_id(&self, compiled_id: &str) -> bool
Returns true when the index contains compiled_id.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &CatalogMessageKey)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &CatalogMessageKey)>
Iterates over compiled IDs in sorted order.
Sourcepub fn as_btreemap(&self) -> &BTreeMap<String, CatalogMessageKey>
pub fn as_btreemap(&self) -> &BTreeMap<String, CatalogMessageKey>
Returns the underlying ordered compiled-ID map by reference.
Sourcepub fn into_btreemap(self) -> BTreeMap<String, CatalogMessageKey>
pub fn into_btreemap(self) -> BTreeMap<String, CatalogMessageKey>
Consumes the index and returns the underlying ordered compiled-ID map.
Sourcepub fn describe_compiled_ids(
&self,
catalogs: &[&NormalizedParsedCatalog],
compiled_ids: &[String],
) -> Result<DescribeCompiledIdsReport, ApiError>
pub fn describe_compiled_ids( &self, catalogs: &[&NormalizedParsedCatalog], compiled_ids: &[String], ) -> Result<DescribeCompiledIdsReport, ApiError>
Describes selected compiled IDs against a provided catalog set.
§Errors
Returns ApiError::InvalidArguments when a provided catalog does not declare
a locale, or ApiError::Conflict when the same compiled ID maps to different
translation kinds across the provided catalogs.
Trait Implementations§
Source§impl Clone for CompiledCatalogIdIndex
impl Clone for CompiledCatalogIdIndex
Source§fn clone(&self) -> CompiledCatalogIdIndex
fn clone(&self) -> CompiledCatalogIdIndex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more