Struct cedar_policy_validator::SchemaFragment

source ·
pub struct SchemaFragment(pub HashMap<Option<Name>, NamespaceDefinition>);
Expand description

A SchemaFragment describe the types for a given instance of Cedar. SchemaFragments are composed of Entity Types and Action Types. The schema fragment is split into multiple namespace definitions, eac including a namespace name which is applied to all entity types (and the implicit Action entity type for all actions) in the schema.

Tuple Fields§

§0: HashMap<Option<Name>, NamespaceDefinition>

Implementations§

source§

impl SchemaFragment

source

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

Create a SchemaFragment from a JSON value (which should be an object of the appropriate shape).

source

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

Create a SchemaFragment directly from a file containing a JSON object.

source

pub fn from_str_natural( src: &str ) -> Result<(Self, impl Iterator<Item = SchemaWarning>), HumanSchemaError>

Parse the schema (in natural schema syntax) from a string

source

pub fn from_file_natural( file: impl Read ) -> Result<(Self, impl Iterator<Item = SchemaWarning>), HumanSchemaError>

Parse the schema (in natural schema syntax) from a reader

source

pub fn as_natural_schema(&self) -> Result<String, ToHumanSchemaStrError>

Pretty print this SchemaFragment

Trait Implementations§

source§

impl Clone for SchemaFragment

source§

fn clone(&self) -> SchemaFragment

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 SchemaFragment

source§

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

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

impl<'de> Deserialize<'de> for SchemaFragment

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for SchemaFragment

source§

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

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

impl PartialEq for SchemaFragment

source§

fn eq(&self, other: &SchemaFragment) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for SchemaFragment

source§

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

Custom serializer to ensure that None is mapped to the empty namespace

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.
source§

impl TryInto<ValidatorSchemaFragment> for SchemaFragment

§

type Error = SchemaError

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

fn try_into(self) -> Result<ValidatorSchemaFragment>

Performs the conversion.
source§

impl StructuralPartialEq for SchemaFragment

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<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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> ToOwned for T
where 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> ToSmolStr for T
where T: Display + ?Sized,

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,