pub struct PermissionValue(/* private fields */);Expand description
Holds a permission value to manipulate.
Implementations§
Source§impl PermissionValue
impl PermissionValue
Sourcepub fn revoke_all(&mut self)
pub fn revoke_all(&mut self)
Revoke all permissions
Sourcepub fn has_user_permission(&self, permission: UserPermission) -> bool
pub fn has_user_permission(&self, permission: UserPermission) -> bool
Check whether certain a user permission has been granted
Sourcepub fn has_channel_permission(&self, permission: ChannelPermission) -> bool
pub fn has_channel_permission(&self, permission: ChannelPermission) -> bool
Check whether certain a channel permission has been granted
Sourcepub fn throw_if_lacking_user_permission(
&self,
permission: UserPermission,
) -> Result<()>
pub fn throw_if_lacking_user_permission( &self, permission: UserPermission, ) -> Result<()>
Throw if missing user permission
Sourcepub fn throw_if_lacking_channel_permission(
&self,
permission: ChannelPermission,
) -> Result<()>
pub fn throw_if_lacking_channel_permission( &self, permission: ChannelPermission, ) -> Result<()>
Throw if missing channel permission
Sourcepub async fn throw_permission_override<C>(
&self,
current_value: C,
next_value: &Override,
) -> Result<()>
pub async fn throw_permission_override<C>( &self, current_value: C, next_value: &Override, ) -> Result<()>
Throw an error if we cannot grant permissions on either allows or denies going from the previous given value to the next given value.
We need to check any:
- allows added (permissions now granted)
- denies removed (permissions now neutral or granted)
Trait Implementations§
Source§impl Clone for PermissionValue
impl Clone for PermissionValue
Source§fn clone(&self) -> PermissionValue
fn clone(&self) -> PermissionValue
Returns a duplicate of the value. Read more
1.0.0 · 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 PermissionValue
impl Debug for PermissionValue
Source§impl From<ChannelPermission> for PermissionValue
impl From<ChannelPermission> for PermissionValue
Source§fn from(v: ChannelPermission) -> Self
fn from(v: ChannelPermission) -> Self
Converts to this type from the input type.
Source§impl From<PermissionValue> for u64
impl From<PermissionValue> for u64
Source§fn from(v: PermissionValue) -> Self
fn from(v: PermissionValue) -> Self
Converts to this type from the input type.
Source§impl From<i64> for PermissionValue
impl From<i64> for PermissionValue
Auto Trait Implementations§
impl Freeze for PermissionValue
impl RefUnwindSafe for PermissionValue
impl Send for PermissionValue
impl Sync for PermissionValue
impl Unpin for PermissionValue
impl UnwindSafe for PermissionValue
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