pub struct ValidatorSchema { /* private fields */ }

Implementations§

source§

impl ValidatorSchema

source

pub fn empty() -> ValidatorSchema

source

pub fn from_json_value(json: Value) -> Result<Self>

Construct a ValidatorSchema from a JSON value (which should be an object matching the SchemaFileFormat shape).

source

pub fn from_file(file: impl Read) -> Result<Self>

Construct a ValidatorSchema directly from a file.

source

pub fn from_schema_file( schema_file: SchemaFragment, action_behavior: ActionBehavior ) -> Result<ValidatorSchema>

source

pub fn from_schema_fragments( fragments: impl IntoIterator<Item = ValidatorSchemaFragment> ) -> Result<ValidatorSchema>

Construct a new ValidatorSchema from some number of schema fragments.

source

pub fn get_action_id(&self, action_id: &EntityUID) -> Option<&ValidatorActionId>

Lookup the ValidatorActionId object in the schema with the given name.

source

pub fn get_entity_type( &self, entity_type_id: &Name ) -> Option<&ValidatorEntityType>

Lookup the ValidatorEntityType object in the schema with the given name.

source

pub fn entity_types( &self ) -> impl Iterator<Item = (&Name, &ValidatorEntityType)>

An iterator matching the entity Types to their Validator Types

source

pub fn get_context_schema( &self, action: &EntityUID ) -> Option<impl ContextSchema>

Since different Actions have different schemas for Context, you must specify the Action in order to get a ContextSchema.

Returns None if the action is not in the schema.

source

pub fn action_entities(&self) -> Result<Entities>

Invert the action hierarchy to get the ancestor relation expected for the Entity datatype instead of descendant as stored by the schema.

Trait Implementations§

source§

impl Clone for ValidatorSchema

source§

fn clone(&self) -> ValidatorSchema

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for ValidatorSchema

source§

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

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

impl FromStr for ValidatorSchema

§

type Err = SchemaError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl Serialize for ValidatorSchema

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<SchemaFragment> for ValidatorSchema

§

type Error = SchemaError

The type returned in the event of a conversion error.
source§

fn try_from(frag: SchemaFragment) -> Result<ValidatorSchema>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

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 Twhere U: TryFrom<T>,

§

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.