Struct discord_flows::model::Permissions
source · pub struct Permissions { /* private fields */ }
Expand description
A set of permissions that can be assigned to User
s and Role
s via
PermissionOverwrite
s, roles globally in a Guild
, and to
GuildChannel
s.
Implementations§
source§impl Permissions
impl Permissions
sourcepub const CREATE_INSTANT_INVITE: Permissions = _
pub const CREATE_INSTANT_INVITE: Permissions = _
Allows for the creation of RichInvite
s.
sourcepub const KICK_MEMBERS: Permissions = _
pub const KICK_MEMBERS: Permissions = _
Allows for the kicking of guild members.
sourcepub const BAN_MEMBERS: Permissions = _
pub const BAN_MEMBERS: Permissions = _
Allows the banning of guild members.
sourcepub const ADMINISTRATOR: Permissions = _
pub const ADMINISTRATOR: Permissions = _
Allows all permissions, bypassing channel permission overwrites.
sourcepub const MANAGE_CHANNELS: Permissions = _
pub const MANAGE_CHANNELS: Permissions = _
Allows management and editing of guild channels.
sourcepub const MANAGE_GUILD: Permissions = _
pub const MANAGE_GUILD: Permissions = _
Allows management and editing of the guild.
sourcepub const ADD_REACTIONS: Permissions = _
pub const ADD_REACTIONS: Permissions = _
sourcepub const VIEW_AUDIT_LOG: Permissions = _
pub const VIEW_AUDIT_LOG: Permissions = _
Allows viewing a guild’s audit logs.
sourcepub const PRIORITY_SPEAKER: Permissions = _
pub const PRIORITY_SPEAKER: Permissions = _
Allows the use of priority speaking in voice channels.
pub const STREAM: Permissions = _
sourcepub const VIEW_CHANNEL: Permissions = _
pub const VIEW_CHANNEL: Permissions = _
Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels.
sourcepub const SEND_MESSAGES: Permissions = _
pub const SEND_MESSAGES: Permissions = _
Allows sending messages in a guild channel.
sourcepub const SEND_TTS_MESSAGES: Permissions = _
pub const SEND_TTS_MESSAGES: Permissions = _
Allows the sending of text-to-speech messages in a channel.
sourcepub const MANAGE_MESSAGES: Permissions = _
pub const MANAGE_MESSAGES: Permissions = _
Allows the deleting of other messages in a guild channel.
Note: This does not allow the editing of other messages.
sourcepub const EMBED_LINKS: Permissions = _
pub const EMBED_LINKS: Permissions = _
Allows links from this user - or users of this role - to be embedded, with potential data such as a thumbnail, description, and page name.
sourcepub const ATTACH_FILES: Permissions = _
pub const ATTACH_FILES: Permissions = _
Allows uploading of files.
sourcepub const READ_MESSAGE_HISTORY: Permissions = _
pub const READ_MESSAGE_HISTORY: Permissions = _
Allows the reading of a channel’s message history.
sourcepub const MENTION_EVERYONE: Permissions = _
pub const MENTION_EVERYONE: Permissions = _
Allows the usage of the @everyone
mention, which will notify all
users in a channel. The @here
mention will also be available, and
can be used to mention all non-offline users.
Note: You probably want this to be disabled for most roles and users.
sourcepub const USE_EXTERNAL_EMOJIS: Permissions = _
pub const USE_EXTERNAL_EMOJIS: Permissions = _
Allows the usage of custom emojis from other guilds.
This does not dictate whether custom emojis in this guild can be used in other guilds.
sourcepub const VIEW_GUILD_INSIGHTS: Permissions = _
pub const VIEW_GUILD_INSIGHTS: Permissions = _
Allows for viewing guild insights.
sourcepub const CONNECT: Permissions = _
pub const CONNECT: Permissions = _
Allows the joining of a voice channel.
sourcepub const SPEAK: Permissions = _
pub const SPEAK: Permissions = _
Allows the user to speak in a voice channel.
sourcepub const MUTE_MEMBERS: Permissions = _
pub const MUTE_MEMBERS: Permissions = _
Allows the muting of members in a voice channel.
sourcepub const DEAFEN_MEMBERS: Permissions = _
pub const DEAFEN_MEMBERS: Permissions = _
Allows the deafening of members in a voice channel.
sourcepub const MOVE_MEMBERS: Permissions = _
pub const MOVE_MEMBERS: Permissions = _
Allows the moving of members from one voice channel to another.
sourcepub const USE_VAD: Permissions = _
pub const USE_VAD: Permissions = _
sourcepub const CHANGE_NICKNAME: Permissions = _
pub const CHANGE_NICKNAME: Permissions = _
Allows members to change their own nickname in the guild.
sourcepub const MANAGE_NICKNAMES: Permissions = _
pub const MANAGE_NICKNAMES: Permissions = _
Allows members to change other members’ nicknames.
sourcepub const MANAGE_ROLES: Permissions = _
pub const MANAGE_ROLES: Permissions = _
Allows management and editing of roles below their own.
sourcepub const MANAGE_WEBHOOKS: Permissions = _
pub const MANAGE_WEBHOOKS: Permissions = _
Allows management of webhooks.
sourcepub const MANAGE_EMOJIS_AND_STICKERS: Permissions = _
pub const MANAGE_EMOJIS_AND_STICKERS: Permissions = _
Allows management of emojis and stickers created without the use of an
Integration
.
sourcepub const USE_SLASH_COMMANDS: Permissions = _
pub const USE_SLASH_COMMANDS: Permissions = _
Allows using slash commands.
sourcepub const REQUEST_TO_SPEAK: Permissions = _
pub const REQUEST_TO_SPEAK: Permissions = _
Allows for requesting to speak in stage channels.
sourcepub const MANAGE_EVENTS: Permissions = _
pub const MANAGE_EVENTS: Permissions = _
Allows for creating, editing, and deleting scheduled events
sourcepub const MANAGE_THREADS: Permissions = _
pub const MANAGE_THREADS: Permissions = _
Allows for deleting and archiving threads, and viewing all private threads.
sourcepub const CREATE_PUBLIC_THREADS: Permissions = _
pub const CREATE_PUBLIC_THREADS: Permissions = _
Allows for creating threads.
sourcepub const CREATE_PRIVATE_THREADS: Permissions = _
pub const CREATE_PRIVATE_THREADS: Permissions = _
Allows for creating private threads.
sourcepub const USE_EXTERNAL_STICKERS: Permissions = _
pub const USE_EXTERNAL_STICKERS: Permissions = _
Allows the usage of custom stickers from other servers.
sourcepub const SEND_MESSAGES_IN_THREADS: Permissions = _
pub const SEND_MESSAGES_IN_THREADS: Permissions = _
Allows for sending messages in threads
sourcepub const USE_EMBEDDED_ACTIVITIES: Permissions = _
pub const USE_EMBEDDED_ACTIVITIES: Permissions = _
Allows for launching activities in a voice channel
sourcepub const MODERATE_MEMBERS: Permissions = _
pub const MODERATE_MEMBERS: Permissions = _
Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels.
sourcepub const fn empty() -> Permissions
pub const fn empty() -> Permissions
Returns an empty set of flags.
sourcepub const fn all() -> Permissions
pub const fn all() -> Permissions
Returns the set containing all flags.
sourcepub const fn from_bits(bits: u64) -> Option<Permissions>
pub const fn from_bits(bits: u64) -> Option<Permissions>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u64) -> Permissions
pub const fn from_bits_truncate(bits: u64) -> Permissions
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u64) -> Permissions
pub const unsafe fn from_bits_unchecked(bits: u64) -> Permissions
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
sourcepub const fn intersects(&self, other: Permissions) -> bool
pub const fn intersects(&self, other: Permissions) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Permissions) -> bool
pub const fn contains(&self, other: Permissions) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn insert(&mut self, other: Permissions)
pub fn insert(&mut self, other: Permissions)
Inserts the specified flags in-place.
sourcepub fn remove(&mut self, other: Permissions)
pub fn remove(&mut self, other: Permissions)
Removes the specified flags in-place.
sourcepub fn toggle(&mut self, other: Permissions)
pub fn toggle(&mut self, other: Permissions)
Toggles the specified flags in-place.
sourcepub fn set(&mut self, other: Permissions, value: bool)
pub fn set(&mut self, other: Permissions, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Permissions) -> Permissions
pub const fn intersection(self, other: Permissions) -> Permissions
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
sourcepub const fn union(self, other: Permissions) -> Permissions
pub const fn union(self, other: Permissions) -> Permissions
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
sourcepub const fn difference(self, other: Permissions) -> Permissions
pub const fn difference(self, other: Permissions) -> Permissions
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
sourcepub const fn symmetric_difference(self, other: Permissions) -> Permissions
pub const fn symmetric_difference(self, other: Permissions) -> Permissions
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
sourcepub const fn complement(self) -> Permissions
pub const fn complement(self) -> Permissions
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
source§impl Binary for Permissions
impl Binary for Permissions
source§impl BitAnd<Permissions> for Permissions
impl BitAnd<Permissions> for Permissions
source§fn bitand(self, other: Permissions) -> Permissions
fn bitand(self, other: Permissions) -> Permissions
Returns the intersection between the two sets of flags.
§type Output = Permissions
type Output = Permissions
&
operator.source§impl BitAndAssign<Permissions> for Permissions
impl BitAndAssign<Permissions> for Permissions
source§fn bitand_assign(&mut self, other: Permissions)
fn bitand_assign(&mut self, other: Permissions)
Disables all flags disabled in the set.
source§impl BitOr<Permissions> for Permissions
impl BitOr<Permissions> for Permissions
source§fn bitor(self, other: Permissions) -> Permissions
fn bitor(self, other: Permissions) -> Permissions
Returns the union of the two sets of flags.
§type Output = Permissions
type Output = Permissions
|
operator.source§impl BitOrAssign<Permissions> for Permissions
impl BitOrAssign<Permissions> for Permissions
source§fn bitor_assign(&mut self, other: Permissions)
fn bitor_assign(&mut self, other: Permissions)
Adds the set of flags.
source§impl BitXor<Permissions> for Permissions
impl BitXor<Permissions> for Permissions
source§fn bitxor(self, other: Permissions) -> Permissions
fn bitxor(self, other: Permissions) -> Permissions
Returns the left flags, but with all the right flags toggled.
§type Output = Permissions
type Output = Permissions
^
operator.source§impl BitXorAssign<Permissions> for Permissions
impl BitXorAssign<Permissions> for Permissions
source§fn bitxor_assign(&mut self, other: Permissions)
fn bitxor_assign(&mut self, other: Permissions)
Toggles the set of flags.
source§impl Clone for Permissions
impl Clone for Permissions
source§fn clone(&self) -> Permissions
fn clone(&self) -> Permissions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Permissions
impl Debug for Permissions
source§impl Default for Permissions
impl Default for Permissions
source§fn default() -> Permissions
fn default() -> Permissions
source§impl<'de> Deserialize<'de> for Permissions
impl<'de> Deserialize<'de> for Permissions
source§fn deserialize<D>(
deserializer: D
) -> Result<Permissions, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<Permissions, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
source§impl Extend<Permissions> for Permissions
impl Extend<Permissions> for Permissions
source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Permissions>,
fn extend<T>(&mut self, iterator: T)where T: IntoIterator<Item = Permissions>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl FromIterator<Permissions> for Permissions
impl FromIterator<Permissions> for Permissions
source§fn from_iter<T>(iterator: T) -> Permissionswhere
T: IntoIterator<Item = Permissions>,
fn from_iter<T>(iterator: T) -> Permissionswhere T: IntoIterator<Item = Permissions>,
source§impl Hash for Permissions
impl Hash for Permissions
source§impl LowerHex for Permissions
impl LowerHex for Permissions
source§impl Not for Permissions
impl Not for Permissions
source§fn not(self) -> Permissions
fn not(self) -> Permissions
Returns the complement of this set of flags.
§type Output = Permissions
type Output = Permissions
!
operator.source§impl Octal for Permissions
impl Octal for Permissions
source§impl Ord for Permissions
impl Ord for Permissions
source§fn cmp(&self, other: &Permissions) -> Ordering
fn cmp(&self, other: &Permissions) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<Permissions> for Permissions
impl PartialEq<Permissions> for Permissions
source§fn eq(&self, other: &Permissions) -> bool
fn eq(&self, other: &Permissions) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<Permissions> for Permissions
impl PartialOrd<Permissions> for Permissions
source§fn partial_cmp(&self, other: &Permissions) -> Option<Ordering>
fn partial_cmp(&self, other: &Permissions) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for Permissions
impl Serialize for Permissions
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
source§impl Sub<Permissions> for Permissions
impl Sub<Permissions> for Permissions
source§fn sub(self, other: Permissions) -> Permissions
fn sub(self, other: Permissions) -> Permissions
Returns the set difference of the two sets of flags.
§type Output = Permissions
type Output = Permissions
-
operator.source§impl SubAssign<Permissions> for Permissions
impl SubAssign<Permissions> for Permissions
source§fn sub_assign(&mut self, other: Permissions)
fn sub_assign(&mut self, other: Permissions)
Disables all flags enabled in the set.