pub struct Permissions { /* private fields */ }
Expand description

A set of permissions that can be assigned to Users and Roles via PermissionOverwrites, roles globally in a Guild, and to GuildChannels.

Discord docs.

Implementations§

source§

impl Permissions

source

pub const CREATE_INSTANT_INVITE: Permissions = _

Allows for the creation of RichInvites.

source

pub const KICK_MEMBERS: Permissions = _

Allows for the kicking of guild members.

source

pub const BAN_MEMBERS: Permissions = _

Allows the banning of guild members.

source

pub const ADMINISTRATOR: Permissions = _

Allows all permissions, bypassing channel permission overwrites.

source

pub const MANAGE_CHANNELS: Permissions = _

Allows management and editing of guild channels.

source

pub const MANAGE_GUILD: Permissions = _

Allows management and editing of the guild.

source

pub const ADD_REACTIONS: Permissions = _

Members with this permission can add new Reactions to a Message. Members can still react using reactions already added to messages without this permission.

source

pub const VIEW_AUDIT_LOG: Permissions = _

Allows viewing a guild’s audit logs.

source

pub const PRIORITY_SPEAKER: Permissions = _

Allows the use of priority speaking in voice channels.

source

pub const STREAM: Permissions = _

source

pub const VIEW_CHANNEL: Permissions = _

Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels.

source

pub const SEND_MESSAGES: Permissions = _

Allows sending messages in a guild channel.

source

pub const SEND_TTS_MESSAGES: Permissions = _

Allows the sending of text-to-speech messages in a channel.

source

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.

Allows links from this user - or users of this role - to be embedded, with potential data such as a thumbnail, description, and page name.

source

pub const ATTACH_FILES: Permissions = _

Allows uploading of files.

source

pub const READ_MESSAGE_HISTORY: Permissions = _

Allows the reading of a channel’s message history.

source

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.

source

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.

source

pub const VIEW_GUILD_INSIGHTS: Permissions = _

Allows for viewing guild insights.

source

pub const CONNECT: Permissions = _

Allows the joining of a voice channel.

source

pub const SPEAK: Permissions = _

Allows the user to speak in a voice channel.

source

pub const MUTE_MEMBERS: Permissions = _

Allows the muting of members in a voice channel.

source

pub const DEAFEN_MEMBERS: Permissions = _

Allows the deafening of members in a voice channel.

source

pub const MOVE_MEMBERS: Permissions = _

Allows the moving of members from one voice channel to another.

source

pub const USE_VAD: Permissions = _

Allows the usage of voice-activity-detection in a voice channel.

If this is disabled, then Members must use push-to-talk.

source

pub const CHANGE_NICKNAME: Permissions = _

Allows members to change their own nickname in the guild.

source

pub const MANAGE_NICKNAMES: Permissions = _

Allows members to change other members’ nicknames.

source

pub const MANAGE_ROLES: Permissions = _

Allows management and editing of roles below their own.

source

pub const MANAGE_WEBHOOKS: Permissions = _

Allows management of webhooks.

source

pub const MANAGE_EMOJIS_AND_STICKERS: Permissions = _

Allows management of emojis and stickers created without the use of an Integration.

source

pub const USE_SLASH_COMMANDS: Permissions = _

Allows using slash commands.

source

pub const REQUEST_TO_SPEAK: Permissions = _

Allows for requesting to speak in stage channels.

source

pub const MANAGE_EVENTS: Permissions = _

Allows for creating, editing, and deleting scheduled events

source

pub const MANAGE_THREADS: Permissions = _

Allows for deleting and archiving threads, and viewing all private threads.

source

pub const CREATE_PUBLIC_THREADS: Permissions = _

Allows for creating threads.

source

pub const CREATE_PRIVATE_THREADS: Permissions = _

Allows for creating private threads.

source

pub const USE_EXTERNAL_STICKERS: Permissions = _

Allows the usage of custom stickers from other servers.

source

pub const SEND_MESSAGES_IN_THREADS: Permissions = _

Allows for sending messages in threads

source

pub const USE_EMBEDDED_ACTIVITIES: Permissions = _

Allows for launching activities in a voice channel

source

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.

source

pub const fn empty() -> Permissions

Returns an empty set of flags.

source

pub const fn all() -> Permissions

Returns the set containing all flags.

source

pub const fn bits(&self) -> u64

Returns the raw value of the flags currently stored.

source

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.

source

pub const fn from_bits_truncate(bits: u64) -> Permissions

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

source

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.

source

pub const fn is_empty(&self) -> bool

Returns true if no flags are currently stored.

source

pub const fn is_all(&self) -> bool

Returns true if all flags are currently set.

source

pub const fn intersects(&self, other: Permissions) -> bool

Returns true if there are flags common to both self and other.

source

pub const fn contains(&self, other: Permissions) -> bool

Returns true if all of the flags in other are contained within self.

source

pub fn insert(&mut self, other: Permissions)

Inserts the specified flags in-place.

source

pub fn remove(&mut self, other: Permissions)

Removes the specified flags in-place.

source

pub fn toggle(&mut self, other: Permissions)

Toggles the specified flags in-place.

source

pub fn set(&mut self, other: Permissions, value: bool)

Inserts or removes the specified flags depending on the passed value.

source

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.

source

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.

source

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.

source

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.

source

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl BitAnd<Permissions> for Permissions

source§

fn bitand(self, other: Permissions) -> Permissions

Returns the intersection between the two sets of flags.

§

type Output = Permissions

The resulting type after applying the & operator.
source§

impl BitAndAssign<Permissions> for Permissions

source§

fn bitand_assign(&mut self, other: Permissions)

Disables all flags disabled in the set.

source§

impl BitOr<Permissions> for Permissions

source§

fn bitor(self, other: Permissions) -> Permissions

Returns the union of the two sets of flags.

§

type Output = Permissions

The resulting type after applying the | operator.
source§

impl BitOrAssign<Permissions> for Permissions

source§

fn bitor_assign(&mut self, other: Permissions)

Adds the set of flags.

source§

impl BitXor<Permissions> for Permissions

source§

fn bitxor(self, other: Permissions) -> Permissions

Returns the left flags, but with all the right flags toggled.

§

type Output = Permissions

The resulting type after applying the ^ operator.
source§

impl BitXorAssign<Permissions> for Permissions

source§

fn bitxor_assign(&mut self, other: Permissions)

Toggles the set of flags.

source§

impl Clone for Permissions

source§

fn clone(&self) -> Permissions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Permissions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Permissions

source§

fn default() -> Permissions

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Permissions

source§

fn deserialize<D>( deserializer: D ) -> Result<Permissions, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Extend<Permissions> for Permissions

source§

fn extend<T>(&mut self, iterator: T)where T: IntoIterator<Item = Permissions>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl FromIterator<Permissions> for Permissions

source§

fn from_iter<T>(iterator: T) -> Permissionswhere T: IntoIterator<Item = Permissions>,

Creates a value from an iterator. Read more
source§

impl Hash for Permissions

source§

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl LowerHex for Permissions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Not for Permissions

source§

fn not(self) -> Permissions

Returns the complement of this set of flags.

§

type Output = Permissions

The resulting type after applying the ! operator.
source§

impl Octal for Permissions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Ord for Permissions

source§

fn cmp(&self, other: &Permissions) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Permissions> for Permissions

source§

fn eq(&self, other: &Permissions) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Permissions> for Permissions

source§

fn partial_cmp(&self, other: &Permissions) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Permissions

source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub<Permissions> for Permissions

source§

fn sub(self, other: Permissions) -> Permissions

Returns the set difference of the two sets of flags.

§

type Output = Permissions

The resulting type after applying the - operator.
source§

impl SubAssign<Permissions> for Permissions

source§

fn sub_assign(&mut self, other: Permissions)

Disables all flags enabled in the set.

source§

impl UpperHex for Permissions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Copy for Permissions

source§

impl Eq for Permissions

source§

impl StructuralEq for Permissions

source§

impl StructuralPartialEq for Permissions

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,