pub struct RoleMap { /* private fields */ }Expand description
Assigns roles to entity IDs and checks permissions.
Implementations§
Source§impl RoleMap
impl RoleMap
pub fn new() -> Self
pub fn assign_role(&mut self, entity: u64, role: &str)
pub fn remove_role(&mut self, entity: u64, role: &str) -> bool
pub fn has_role(&self, entity: u64, role: &str) -> bool
pub fn roles_of(&self, entity: u64) -> Vec<String>
pub fn define_permission(&mut self, role: &str, perm: &str)
pub fn has_permission(&self, entity: u64, perm: &str) -> bool
pub fn entity_count(&self) -> usize
pub fn role_count(&self) -> usize
pub fn entities_with_role(&self, role: &str) -> Vec<u64>
pub fn clear_entity(&mut self, entity: u64)
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoleMap
impl RefUnwindSafe for RoleMap
impl Send for RoleMap
impl Sync for RoleMap
impl Unpin for RoleMap
impl UnsafeUnpin for RoleMap
impl UnwindSafe for RoleMap
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