#[non_exhaustive]pub struct Overwrite {
pub id: GenericId,
pub kind: OverwriteType,
pub allow: Permissions,
pub deny: Permissions,
}Expand description
A permission overwrite: permissions explicitly allowed or denied for a role or member in a channel.
discord.js counterpart: PermissionOverwrites.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: GenericIdThe role or user ID, depending on kind.
kind: OverwriteTypeWhether the overwrite is for a role or a member.
allow: PermissionsThe permissions explicitly allowed.
deny: PermissionsThe permissions explicitly denied.
Implementations§
Source§impl Overwrite
impl Overwrite
Sourcepub const fn new(
id: GenericId,
kind: OverwriteType,
allow: Permissions,
deny: Permissions,
) -> Self
pub const fn new( id: GenericId, kind: OverwriteType, allow: Permissions, deny: Permissions, ) -> Self
An overwrite of kind for the role or user id.
discord.js counterpart: OverwriteData.
Sourcepub const fn role(
role_id: RoleId,
allow: Permissions,
deny: Permissions,
) -> Self
pub const fn role( role_id: RoleId, allow: Permissions, deny: Permissions, ) -> Self
An overwrite for a role (@everyone has the guild’s ID).
discord.js counterpart: OverwriteData with type: OverwriteType.Role.
§Examples
use djs_model::{channel::Overwrite, id::RoleId, permissions::Permissions};
let read_only = Overwrite::role(RoleId::new(1), Permissions::VIEW_CHANNEL, Permissions::SEND_MESSAGES);
assert_eq!(read_only.role_id(), Some(RoleId::new(1)));Sourcepub const fn member(
user_id: UserId,
allow: Permissions,
deny: Permissions,
) -> Self
pub const fn member( user_id: UserId, allow: Permissions, deny: Permissions, ) -> Self
An overwrite for a member.
discord.js counterpart: OverwriteData with type: OverwriteType.Member.
Trait Implementations§
impl Copy for Overwrite
Source§impl<'de> Deserialize<'de> for Overwrite
impl<'de> Deserialize<'de> for Overwrite
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
impl Eq for Overwrite
impl StructuralPartialEq for Overwrite
Auto Trait Implementations§
impl Freeze for Overwrite
impl RefUnwindSafe for Overwrite
impl Send for Overwrite
impl Sync for Overwrite
impl Unpin for Overwrite
impl UnsafeUnpin for Overwrite
impl UnwindSafe for Overwrite
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