pub struct ValidatorSchema { /* private fields */ }Implementations§
Source§impl ValidatorSchema
impl ValidatorSchema
Sourcepub fn principals(&self) -> impl Iterator<Item = &EntityType>
pub fn principals(&self) -> impl Iterator<Item = &EntityType>
Returns an iterator over every entity type that can be a principal for any action in this schema
Sourcepub fn resources(&self) -> impl Iterator<Item = &EntityType>
pub fn resources(&self) -> impl Iterator<Item = &EntityType>
Returns an iterator over every entity type that can be a resource for any action in this schema
Sourcepub fn principals_for_action(
&self,
action: &EntityUID,
) -> Option<impl Iterator<Item = &EntityType>>
pub fn principals_for_action( &self, action: &EntityUID, ) -> Option<impl Iterator<Item = &EntityType>>
Sourcepub fn resources_for_action(
&self,
action: &EntityUID,
) -> Option<impl Iterator<Item = &EntityType>>
pub fn resources_for_action( &self, action: &EntityUID, ) -> Option<impl Iterator<Item = &EntityType>>
Sourcepub fn ancestors<'a>(
&'a self,
ty: &'a Name,
) -> Option<impl Iterator<Item = &'a Name> + 'a>
pub fn ancestors<'a>( &'a self, ty: &'a Name, ) -> Option<impl Iterator<Item = &'a Name> + 'a>
Sourcepub fn action_groups(&self) -> impl Iterator<Item = &EntityUID>
pub fn action_groups(&self) -> impl Iterator<Item = &EntityUID>
Returns an iterator over all the action groups defined in this schema
Sourcepub fn actions(&self) -> impl Iterator<Item = &EntityUID>
pub fn actions(&self) -> impl Iterator<Item = &EntityUID>
Returns an iterator over all actions defined in this schema
Sourcepub fn empty() -> ValidatorSchema
pub fn empty() -> ValidatorSchema
Create a ValidatorSchema without any definitions (of entity types,
common types, or actions).
Sourcepub fn from_json_value(json: Value, extensions: Extensions<'_>) -> Result<Self>
pub fn from_json_value(json: Value, extensions: Extensions<'_>) -> 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, extensions: Extensions<'_>) -> Result<Self>
pub fn from_file(file: impl Read, extensions: Extensions<'_>) -> Result<Self>
Construct a ValidatorSchema directly from a file.
pub fn from_file_natural( r: impl Read, extensions: Extensions<'_>, ) -> Result<(Self, impl Iterator<Item = SchemaWarning>), HumanSchemaError>
pub fn from_str_natural( src: &str, extensions: Extensions<'_>, ) -> Result<(Self, impl Iterator<Item = SchemaWarning>), HumanSchemaError>
pub fn from_schema_file( schema_file: SchemaFragment, action_behavior: ActionBehavior, extensions: Extensions<'_>, ) -> 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<'a>(
&'a self,
entity_type_id: &Name,
) -> Option<&'a ValidatorEntityType>
pub fn get_entity_type<'a>( &'a self, entity_type_id: &Name, ) -> Option<&'a 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 context_type(&self, action: &EntityUID) -> Option<Type>
pub fn context_type(&self, action: &EntityUID) -> Option<Type>
Get the Type of context expected for the given action.
This always reutrns a closed record type.
Returns None if the action is not in the schema.
Sourcepub fn action_entities(&self) -> Result<Entities, EntitiesError>
pub fn action_entities(&self) -> Result<Entities, EntitiesError>
Construct an Entity object for each action in the schema
Trait Implementations§
Source§impl Clone for ValidatorSchema
impl Clone for ValidatorSchema
Source§fn clone(&self) -> ValidatorSchema
fn clone(&self) -> ValidatorSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidatorSchema
impl Debug for ValidatorSchema
Source§impl FromStr for ValidatorSchema
impl FromStr for ValidatorSchema
Source§impl RequestSchema for ValidatorSchema
impl RequestSchema for ValidatorSchema
Source§type Error = RequestValidationError
type Error = RequestValidationError
Source§fn validate_request(
&self,
request: &Request,
extensions: Extensions<'_>,
) -> Result<(), Self::Error>
fn validate_request( &self, request: &Request, extensions: Extensions<'_>, ) -> Result<(), Self::Error>
request, returning Err if it fails validationSource§impl Serialize for ValidatorSchema
impl Serialize for ValidatorSchema
Source§impl TryFrom<SchemaFragment> for ValidatorSchema
impl TryFrom<SchemaFragment> for ValidatorSchema
Source§type Error = SchemaError
type Error = SchemaError
Source§fn try_from(frag: SchemaFragment) -> Result<ValidatorSchema>
fn try_from(frag: SchemaFragment) -> Result<ValidatorSchema>
Auto Trait Implementations§
impl Freeze for ValidatorSchema
impl RefUnwindSafe for ValidatorSchema
impl Send for ValidatorSchema
impl Sync for ValidatorSchema
impl Unpin for ValidatorSchema
impl UnsafeUnpin 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
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>
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