pub struct Catalog { /* private fields */ }Expand description
A loaded, checked catalog.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn basic() -> &'static Catalog
pub fn basic() -> &'static Catalog
The specification’s basic catalog (catalogs/basic/v1), vendored.
Sourcepub fn from_value(document: Value) -> Result<Catalog, CatalogError>
pub fn from_value(document: Value) -> Result<Catalog, CatalogError>
Load a catalog document, checking it against catalog_definition.json
and the rules the schema cannot express: protocolVersion must be
1.0; component, function, property, and $defs names must be UAX #31
identifiers; every $ref must target this catalog’s own components,
functions, or leaf $defs, or one of ALLOWED_EXTERNAL_REF_TARGETS;
and each component must declare component as the constant of its own
name. Nothing the document refers to is fetched.
Sourcepub fn instructions(&self) -> Option<&str>
pub fn instructions(&self) -> Option<&str>
The catalog’s instructions for the model, if it has any.
Sourcepub fn components(&self) -> &BTreeMap<String, ComponentDef>
pub fn components(&self) -> &BTreeMap<String, ComponentDef>
The component types, by name.
Sourcepub fn functions(&self) -> &BTreeMap<String, FunctionDef>
pub fn functions(&self) -> &BTreeMap<String, FunctionDef>
The functions, by name.
Sourcepub fn component(&self, name: &str) -> Option<&ComponentDef>
pub fn component(&self, name: &str) -> Option<&ComponentDef>
One component type, if the catalog has it.
Sourcepub fn function(&self, name: &str) -> Option<&FunctionDef>
pub fn function(&self, name: &str) -> Option<&FunctionDef>
One function, if the catalog has it.
Sourcepub fn declares(&self, type_name: &str, name: &str) -> bool
pub fn declares(&self, type_name: &str, name: &str) -> bool
Whether this catalog’s schema for component type_name declares a
property name: in its own properties, or those of any allOf,
oneOf, or anyOf branch, or of a $defs entry it refers to. A
component may declare catalogId, metadata, accessibility, or
checks as ordinary properties, which then are not the legacy spellings
of the @ envelope keys.
Sourcepub fn declares_own(&self, type_name: &str, name: &str) -> bool
pub fn declares_own(&self, type_name: &str, name: &str) -> bool
Whether name is component type_name’s own property here, not the
envelope’s: Catalog::declares, except that a catalogId or
metadata declared in a properties block that also declares id, in
the standard shape (a string catalogId, or a metadata object whose
only property is extensions), is the envelope’s, as early 1.0 drafts
inlined it.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Catalog
impl Freeze for Catalog
impl Move 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more