pub struct Catalog { /* private fields */ }Expand description
A validated .mf2b catalog (F2): the fetched buffer and the offsets
new found. Share it as Rc<Catalog> / Arc<Catalog>.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn new(
bytes: Vec<u8>,
expect_manifest: u64,
) -> Result<Catalog, CatalogError>
pub fn new( bytes: Vec<u8>, expect_manifest: u64, ) -> Result<Catalog, CatalogError>
Takes ownership of a fetched .mf2b buffer and validates its
structure once: magic, version (F9), manifest_hash (F6), the section
table, INDEX bounds and monotonicity, and the NAMES, FUNCS, FALLBACK,
LOCALE (with its plural entries) and IDS tables. Strings are checked
when read (F4). Linear in the buffer; allocates nothing; no copy (F2).
Sourcepub fn manifest_hash(&self) -> u64
pub fn manifest_hash(&self) -> u64
The manifest hash this catalog was compiled against (F6).
Sourcepub fn cldr_version(&self) -> Option<CldrVersion>
pub fn cldr_version(&self) -> Option<CldrVersion>
The CLDR version of the locale data, if any.
Sourcepub fn message_count(&self) -> u32
pub fn message_count(&self) -> u32
The number of ids in the manifest (INDEX entries).
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Gives the buffer back (a copy, for a catalog over static bytes).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more