pub enum Role {
Public,
Internal,
Developer,
}Expand description
Role visibility for documentation generation
Controls who sees this error in generated documentation.
Variants§
Public
Visible to all users (library consumers, end users)
Internal
Visible only to team members (internal documentation)
Developer
Visible only to library/compiler developers
Implementations§
Source§impl Role
impl Role
Sourcepub fn privilege_level(&self) -> u8
pub fn privilege_level(&self) -> u8
Returns the privilege level for hierarchical comparisons.
Lower numbers are more restrictive:
- Public: 0 (most restrictive)
- Developer: 1
- Internal: 2 (least restrictive, sees everything)
Sourcepub fn can_view(&self, content_role: Option<Role>) -> bool
pub fn can_view(&self, content_role: Option<Role>) -> bool
Check if this role can view content marked with the given role.
Visibility is hierarchical:
- Public can only see Public content
- Developer can see Public and Developer content
- Internal can see all content
- Content with None (unspecified) is visible to everyone
§Examples
use waddling_errors::traits::Role;
assert!(Role::Public.can_view(Some(Role::Public)));
assert!(!Role::Public.can_view(Some(Role::Internal)));
assert!(Role::Internal.can_view(Some(Role::Public)));
assert!(Role::Developer.can_view(None)); // Unspecified visible to allTrait Implementations§
impl Copy for Role
impl Eq for Role
impl StructuralPartialEq for Role
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§
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