pub struct PermissionSet { /* private fields */ }Expand description
Set of permissions for a module
Implementations§
Source§impl PermissionSet
impl PermissionSet
Sourcepub fn new() -> PermissionSet
pub fn new() -> PermissionSet
Create a new empty permission set
Sourcepub fn from_vec(permissions: Vec<Permission>) -> PermissionSet
pub fn from_vec(permissions: Vec<Permission>) -> PermissionSet
Create a permission set from a vector
Sourcepub fn add(&mut self, permission: Permission)
pub fn add(&mut self, permission: Permission)
Add a permission
Sourcepub fn has(&self, permission: &Permission) -> bool
pub fn has(&self, permission: &Permission) -> bool
Check if a permission is granted
Sourcepub fn has_all(&self, required: &[Permission]) -> bool
pub fn has_all(&self, required: &[Permission]) -> bool
Check if all required permissions are granted
Sourcepub fn to_vec(&self) -> Vec<Permission>
pub fn to_vec(&self) -> Vec<Permission>
Get all permissions as a vector
Trait Implementations§
Source§impl Clone for PermissionSet
impl Clone for PermissionSet
Source§fn clone(&self) -> PermissionSet
fn clone(&self) -> PermissionSet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PermissionSet
impl Debug for PermissionSet
Source§impl Default for PermissionSet
impl Default for PermissionSet
Source§fn default() -> PermissionSet
fn default() -> PermissionSet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PermissionSet
impl RefUnwindSafe for PermissionSet
impl Send for PermissionSet
impl Sync for PermissionSet
impl Unpin for PermissionSet
impl UnsafeUnpin for PermissionSet
impl UnwindSafe for PermissionSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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