Skip to main content

Catalog

Struct Catalog 

Source
pub struct Catalog { /* private fields */ }
Expand description

A loaded, checked catalog.

Implementations§

Source§

impl Catalog

Source

pub fn basic() -> &'static Catalog

The specification’s basic catalog (catalogs/basic/v1), vendored.

Source

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.

Source

pub fn id(&self) -> &str

The catalog’s id (catalogId).

Source

pub fn document(&self) -> &Value

The catalog’s JSON Schema document, as loaded.

Source

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

The catalog’s instructions for the model, if it has any.

Source

pub fn components(&self) -> &BTreeMap<String, ComponentDef>

The component types, by name.

Source

pub fn functions(&self) -> &BTreeMap<String, FunctionDef>

The functions, by name.

Source

pub fn component(&self, name: &str) -> Option<&ComponentDef>

One component type, if the catalog has it.

Source

pub fn function(&self, name: &str) -> Option<&FunctionDef>

One function, if the catalog has it.

Source

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.

Source

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§

Source§

impl Clone for Catalog

Source§

fn clone(&self) -> Self

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

Auto Trait Implementations§

§

impl Forget for Catalog

§

impl Freeze for Catalog

§

impl Move for Catalog

§

impl RefUnwindSafe for Catalog

§

impl Send for Catalog
where RawVecInner: Send, RawTable<usize>: Send, NodeRef<Owned, String, ComponentDef, LeafOrInternal>: Send, BoxRaw<(String, ComponentDef)>: Send, NodeRef<Owned, String, FunctionDef, LeafOrInternal>: Send, BoxRaw<(String, FunctionDef)>: Send,

§

impl Sync for Catalog
where RawVecInner: Sync, RawTable<usize>: Sync, NodeRef<Owned, String, ComponentDef, LeafOrInternal>: Sync, BoxRaw<(String, ComponentDef)>: Sync, NodeRef<Owned, String, FunctionDef, LeafOrInternal>: Sync, BoxRaw<(String, FunctionDef)>: Sync,

§

impl Unpin for Catalog
where *const u8 is !null: Unpin, *const LeafNode<String, ComponentDef> is !null: Unpin, Box<(String, ComponentDef)>: Unpin, *const LeafNode<String, FunctionDef> is !null: Unpin, Box<(String, FunctionDef)>: Unpin,

§

impl UnsafeUnpin for Catalog

§

impl UnwindSafe for Catalog

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, !>

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.