pub struct RightsSchema { /* private fields */ }Expand description
The rights one type of item has, by name, and the aliases that stand for several.
A right is one bit, numbered in the order it is defined. An alias names a set of rights
and earlier aliases: Windows generic rights, NFSv4 basic permissions and Proxmox roles
are all aliases. A cancelling name (RightsSchemaBuilder::cancel) grants nothing, and
an entry naming it denies everything (Proxmox’s NoAccess).
use coqui_access_acl::RightsSchema;
let schema = RightsSchema::builder()
.right("read_data")
.right("read_attributes")
.right("write_data")
.alias("read", ["read_data", "read_attributes"])
.build()?;
assert_eq!(schema.rights(["read"])?, schema.rights(["read_data", "read_attributes"])?);
assert!(schema.rights(["delete"]).is_err());Implementations§
Source§impl RightsSchema
impl RightsSchema
Sourcepub fn builder() -> RightsSchemaBuilder
pub fn builder() -> RightsSchemaBuilder
Starts a schema; rights take bits in the order they are added.
Sourcepub fn bit(&self, name: &str) -> Option<usize>
pub fn bit(&self, name: &str) -> Option<usize>
The bit of the right name; None for an alias or an unknown name.
Trait Implementations§
Source§impl Clone for RightsSchema
impl Clone for RightsSchema
Source§impl Debug for RightsSchema
impl Debug for RightsSchema
Auto Trait Implementations§
impl Freeze for RightsSchema
impl RefUnwindSafe for RightsSchema
impl Send for RightsSchema
impl Sync for RightsSchema
impl Unpin for RightsSchema
impl UnsafeUnpin for RightsSchema
impl UnwindSafe for RightsSchema
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