Skip to main content

SchemaSet

Struct SchemaSet 

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

The message schemas compiled against one catalog.

Implementations§

Source§

impl SchemaSet

Source

pub fn for_catalog(catalog: &Catalog) -> Result<Self, CompileError>

Compile agent_to_renderer.json and renderer_to_agent.json with catalog.json mapped to catalog.

Source

pub fn for_document(catalog: &Value) -> Result<Self, CompileError>

As SchemaSet::for_catalog, from a catalog’s JSON document as it is, unchecked. For the specification’s tests, which pair messages with catalogs; use SchemaSet::for_catalog otherwise.

Source

pub fn check_agent_message_as( &self, kind: &str, message: &Value, ) -> Result<(), Vec<SchemaError>>

Check a message against one kind’s definition ("createSurface", …). Valid exactly when SchemaSet::check_agent_message is for a message holding that kind’s key, with errors about that kind only.

Source

pub fn check_agent_message( &self, message: &Value, ) -> Result<(), Vec<SchemaError>>

Check one agent-to-renderer message against the envelope schema and the catalog. This is the schema half of validation only: whether a surface exists, whether root is there, and the composition rules are checked by crate::Validator.

Source

pub fn check_function_call(&self, call: &Value) -> Result<(), Vec<SchemaError>>

Check one function call ({"@call": ..., "args": ...}) against this catalog’s functions: that it names one, and its arguments.

Source

pub fn check_renderer_message( &self, message: &Value, ) -> Result<(), Vec<SchemaError>>

Check one renderer-to-agent message (an action, a function call or response, an error).

Trait Implementations§

Source§

impl Debug for SchemaSet

Source§

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

Formats the value using the given formatter. Read more

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