pub struct Role { /* private fields */ }Expand description
A role declaration with exact permissions and optional parent roles.
Implementations§
Source§impl Role
impl Role
Sourcepub fn new(name: impl AsRef<str>) -> Result<Self, RbacError>
pub fn new(name: impl AsRef<str>) -> Result<Self, RbacError>
§Errors
Returns an error for an invalid role name.
Sourcepub fn allow(self, permission: impl AsRef<str>) -> Result<Self, RbacError>
pub fn allow(self, permission: impl AsRef<str>) -> Result<Self, RbacError>
§Errors
Returns an error for an invalid permission name.
Sourcepub fn inherits(self, parent: impl AsRef<str>) -> Result<Self, RbacError>
pub fn inherits(self, parent: impl AsRef<str>) -> Result<Self, RbacError>
§Errors
Returns an error for an invalid parent-role name.
pub fn name(&self) -> &str
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Role
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnsafeUnpin for Role
impl UnwindSafe for Role
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