pub struct Group(/* private fields */);Expand description
A group identifier used for exact membership checks.
Groups are the non-hierarchical companion to roles. Use them when access is based on belonging to something, such as a department, project, tenant, or on-call rotation.
§Example
use webgates_core::groups::Group;
let engineering = Group::new("engineering");
let backend_team = Group::new("backend-team");
assert_eq!(engineering.name(), "engineering");
assert_eq!(backend_team.name(), "backend-team");Implementations§
Source§impl Group
impl Group
Sourcepub fn new(group: &str) -> Self
pub fn new(group: &str) -> Self
Creates a new group from its stable name.
The name should be application-defined and stable over time.
§Parameters
group: Group identifier such as"engineering"or"project-alpha".
§Example
use webgates_core::groups::Group;
let engineering = Group::new("engineering");
let project_team = Group::new("project-alpha-team");
assert_eq!(engineering.name(), "engineering");
assert_eq!(project_team.name(), "project-alpha-team");Trait Implementations§
Source§impl<'de> Deserialize<'de> for Group
impl<'de> Deserialize<'de> for Group
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl GroupEntity for Group
Allows the built-in Group type to be used wherever a GroupEntity
is required.
impl GroupEntity for Group
Allows the built-in Group type to be used wherever a GroupEntity
is required.
impl Eq for Group
impl StructuralPartialEq for Group
Auto Trait Implementations§
impl Freeze for Group
impl RefUnwindSafe for Group
impl Send for Group
impl Sync for Group
impl Unpin for Group
impl UnsafeUnpin for Group
impl UnwindSafe for Group
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