Skip to main content

Catalog

Struct Catalog 

Source
pub struct Catalog {
    pub schema_version: u32,
    pub locales: Vec<Locale>,
    pub target: TargetMeta,
    pub provenance: Provenance,
    /* private fields */
}
Expand description

The validated canonical Workshop catalog.

Fields§

§schema_version: u32§locales: Vec<Locale>

The declared locales, normalized; the first one is the primary locale and must be fully covered.

§target: TargetMeta§provenance: Provenance

Implementations§

Source§

impl Catalog

Source

pub fn load(json: &str) -> Result<Catalog, WorkshopError>

Parse and validate catalog data, verifying the declared content digest when the data carries one.

Source

pub fn load_unverified(json: &str) -> Result<Catalog, WorkshopError>

Parse and validate catalog data without digest verification. Used by the catalog pipeline so a stale digest can be repaired by build.

Source

pub fn builtin() -> Result<Catalog, WorkshopError>

The built-in catalog data.

Source

pub fn locales(&self) -> &[Locale]

The declared locales, normalized; the first one is the primary locale.

Source

pub fn primary_locale(&self) -> &Locale

The primary locale: the first declared one, whose mapping surface is complete (en-US in the committed catalog).

Source

pub fn supports(&self, locale: &Locale) -> bool

Whether a locale is declared by the catalog.

Source

pub fn catalog_version(&self) -> &str

The catalog dataset version (ADR-0001 catalog-version).

Source

pub fn catalog_digest(&self) -> Option<&str>

The declared content digest (sha256 hex) of the catalog dataset, verified at load; None for data that declares none.

Source

pub fn implementation_version() -> &'static str

The workshop-rs package version (ADR-0001 implementation-version).

Source

pub fn identity(&self) -> CatalogIdentity

The machine-readable catalog identity: implementation version, catalog version + digest, locale coverage, target evidence, and provenance.

Source

pub fn locale_coverage(&self, locale: &Locale) -> LocaleCoverage

The mapping coverage of one declared locale: mapped entries out of the declared total (builtins, localized preset identities, and enum members). The primary locale is always complete; other locales may be partially covered.

Source

pub fn locale_coverage_all(&self) -> Vec<LocaleCoverage>

The mapping coverage of every declared locale, in declaration order.

Source

pub fn entry(&self, kind: Kind, id: &str) -> Option<&CatalogEntry>

The builtin with the given canonical id and kind.

Source

pub fn resolve( &self, kind: Kind, locale: &Locale, spelling: &str, ) -> Option<&CatalogEntry>

Resolve a localized spelling to its canonical builtin.

Source

pub fn spelling(&self, kind: Kind, locale: &Locale, id: &str) -> Option<&str>

The localized spelling of a canonical builtin id.

Source

pub fn entries_of(&self, kind: Kind) -> impl Iterator<Item = &CatalogEntry>

Every entry of a kind, in catalog order.

Source

pub fn resolve_localized_string( &self, locale: &Locale, spelling: &str, ) -> Option<&LocalizedStringEntry>

Resolve a localized preset spelling to its stable identity.

Source

pub fn localized_string_spelling( &self, locale: &Locale, id: &str, ) -> Option<&str>

Resolve the emitted spelling of a localized preset identity.

Source

pub fn localized_strings(&self) -> impl Iterator<Item = &LocalizedStringEntry>

Every reviewed localized preset identity, in catalog order.

Source

pub fn entry_count(&self) -> usize

The total number of builtin entries.

Source

pub fn enum_domains_count(&self) -> usize

The number of enum domains.

Source

pub fn enum_domain(&self, domain: &str) -> Option<&EnumDomain>

The enum domain with the given name.

Source

pub fn resolve_enum_domain( &self, locale: &Locale, spelling: &str, ) -> Option<&str>

Resolve a localized enum-domain spelling to its canonical domain id.

Source

pub fn enum_domains(&self) -> impl Iterator<Item = &EnumDomain>

Every enum domain, in catalog order.

Source

pub fn resolve_enum_member( &self, domain: &str, locale: &Locale, spelling: &str, ) -> Option<(String, String)>

Resolve a localized enum member spelling to (domain, canonical member).

Source

pub fn enum_spelling( &self, domain: &str, locale: &Locale, member: &str, ) -> Option<&str>

The localized spelling of a canonical enum member.

Source

pub fn bare_member_matches( &self, locale: &Locale, spelling: &str, ) -> Vec<(String, String)>

Every (domain, canonical member) match for a bare (domain-less) localized member spelling. Returns all matches so callers can report ambiguity; a well-formed catalog has at most one meaningful match for a given spelling.

Trait Implementations§

Source§

impl Clone for Catalog

Source§

fn clone(&self) -> Catalog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Catalog

Source§

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

Formats the value using the given formatter. Read more
Source§

impl ExpectedDomain for Catalog

The catalog is the canonical source of expected enum domains for the Workshop surface it documents: expected_domain(catalog_id, arg_index) answers the domain declared for that parameter position (e.g. createHudText argument 9 is HudReeval), so the Workshop parser can resolve bare enum members that are ambiguous across domains (e.g. Visible To and String). Positions without a documented domain answer None.

Source§

fn expected_domain(&self, catalog_id: &str, arg_index: usize) -> Option<&str>

The expected enum domain for arg_index of the call with catalog id catalog_id, or None when the signature does not pin one.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <T as TryFrom<U>>::Error>

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.