pub struct Role {
pub name: &'static str,
pub allowed_types: [&'static str; 16],
pub type_count: usize,
}Expand description
Role definition mapping a role name to allowed types.
Uses fixed-size array of &'static str to avoid heap allocations.
Fields§
§name: &'static strRole name (e.g. “admin_r”, “user_r”)
allowed_types: [&'static str; 16]Types this role is allowed to transition to
type_count: usizeNumber of active types in the array
Implementations§
Source§impl Role
impl Role
Sourcepub fn from_types(name: &'static str, types: &[&'static str]) -> Self
pub fn from_types(name: &'static str, types: &[&'static str]) -> Self
Create a new role with allowed types from a slice.
Sourcepub fn allows_type(&self, type_name: &str) -> bool
pub fn allows_type(&self, type_name: &str) -> bool
Check if this role allows the given type.
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 UnwindSafe for Role
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)