pub struct Schema { /* private fields */ }Expand description
Object types and their relations.
Implementations§
Source§impl Schema
impl Schema
pub fn new() -> Schema
Sourcepub fn relation(
self,
kind: &str,
relation: &str,
definition: &str,
) -> Result<Schema, AuthzError>
pub fn relation( self, kind: &str, relation: &str, definition: &str, ) -> Result<Schema, AuthzError>
Define relation on kind as definition (see parse_expression).
Names are resolved when the schema is used (Schema::validate), so
definitions may refer to types defined later.
Sourcepub fn object_type(self, kind: &str) -> Result<Schema, AuthzError>
pub fn object_type(self, kind: &str) -> Result<Schema, AuthzError>
A type with no relations of its own (e.g. user).
pub fn has_relation(&self, kind: &str, relation: &str) -> bool
Sourcepub fn validate(&self) -> Result<Schema, AuthzError>
pub fn validate(&self) -> Result<Schema, AuthzError>
Resolve bare names (a type used as a subject type, or else a relation
on the same object) and check every reference; returns the resolved
schema. Subject types that appear only in definitions (user) become
types.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
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