pub struct ValidatorSchema { /* private fields */ }Implementations§
Source§impl ValidatorSchema
impl ValidatorSchema
pub fn empty() -> ValidatorSchema
Sourcepub fn from_json_value(json: Value) -> Result<Self>
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).
Sourcepub fn from_file(file: impl Read) -> Result<Self>
pub fn from_file(file: impl Read) -> Result<Self>
Construct a ValidatorSchema directly from a file.
pub fn from_schema_file( schema_file: SchemaFragment, action_behavior: ActionBehavior, ) -> Result<ValidatorSchema>
Sourcepub fn from_schema_fragments(
fragments: impl IntoIterator<Item = ValidatorSchemaFragment>,
) -> Result<ValidatorSchema>
pub fn from_schema_fragments( fragments: impl IntoIterator<Item = ValidatorSchemaFragment>, ) -> Result<ValidatorSchema>
Construct a new ValidatorSchema from some number of schema fragments.
Sourcepub fn get_action_id(&self, action_id: &EntityUID) -> Option<&ValidatorActionId>
pub fn get_action_id(&self, action_id: &EntityUID) -> Option<&ValidatorActionId>
Lookup the ValidatorActionId object in the schema with the given name.
Sourcepub fn get_entity_type(
&self,
entity_type_id: &Name,
) -> Option<&ValidatorEntityType>
pub fn get_entity_type( &self, entity_type_id: &Name, ) -> Option<&ValidatorEntityType>
Lookup the ValidatorEntityType object in the schema with the given name.
Sourcepub fn entity_types(
&self,
) -> impl Iterator<Item = (&Name, &ValidatorEntityType)>
pub fn entity_types( &self, ) -> impl Iterator<Item = (&Name, &ValidatorEntityType)>
An iterator matching the entity Types to their Validator Types
Sourcepub fn get_context_schema(
&self,
action: &EntityUID,
) -> Option<impl ContextSchema>
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.
pub fn action_entities(&self) -> Result<Entities>
Trait Implementations§
Source§impl Clone for ValidatorSchema
impl Clone for ValidatorSchema
Source§fn clone(&self) -> ValidatorSchema
fn clone(&self) -> ValidatorSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidatorSchema
impl Debug for ValidatorSchema
Source§impl FromStr for ValidatorSchema
impl FromStr for ValidatorSchema
Source§impl Schema for ValidatorSchema
impl Schema for ValidatorSchema
Source§fn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>
fn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>
Do entities of the given type have the given attribute, and if so, what type? Read more
Source§fn required_attrs<'s>(
&'s self,
entity_type: &EntityType,
) -> Box<dyn Iterator<Item = SmolStr> + 's>
fn required_attrs<'s>( &'s self, entity_type: &EntityType, ) -> Box<dyn Iterator<Item = SmolStr> + 's>
Get the names of all the required attributes for the given entity type.
Source§impl Serialize for ValidatorSchema
impl Serialize for ValidatorSchema
Source§impl TryInto<ValidatorSchema> for SchemaFragment
impl TryInto<ValidatorSchema> for SchemaFragment
Source§type Error = SchemaError
type Error = SchemaError
The type returned in the event of a conversion error.
Source§fn try_into(self) -> Result<ValidatorSchema>
fn try_into(self) -> Result<ValidatorSchema>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for ValidatorSchema
impl RefUnwindSafe for ValidatorSchema
impl Send for ValidatorSchema
impl Sync for ValidatorSchema
impl Unpin for ValidatorSchema
impl UnwindSafe for ValidatorSchema
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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