[][src]Struct serenity::model::guild::Role

pub struct Role {
    pub id: RoleId,
    pub colour: Colour,
    pub hoist: bool,
    pub managed: bool,
    pub mentionable: bool,
    pub name: String,
    pub permissions: Permissions,
    pub position: i64,
}

Information about a role within a guild. A role represents a set of permissions, and can be attached to one or multiple users. A role has various miscellaneous configurations, such as being assigned a colour. Roles are unique per guild and do not cross over to other guilds in any way, and can have channel-specific permission overrides in addition to guild-level permissions.

Fields

The Id of the role. Can be used to calculate the role's creation date.

The colour of the role. This is an ergonomic representation of the inner value.

Indicator of whether the role is pinned above lesser roles.

In the client, this causes Members in the role to be seen above those in roles with a lower position.

Indicator of whether the role is managed by an integration service.

Indicator of whether the role can be mentioned, similar to mentioning a specific member or @everyone.

Only members of the role will be notified if a role is mentioned with this set to true.

The name of the role.

A set of permissions that the role has been assigned.

See the permissions module for more information.

The role's position in the position list. Roles are considered higher in hierarchy if their position is higher.

The @everyone role is usually either -1 or 0.

Methods

impl Role
[src]

Deletes the role.

Note Requires the Manage Roles permission.

Edits a Role, optionally setting its new fields.

Requires the Manage Roles permission.

Examples

Make a role hoisted:

// assuming a `role` has already been bound
role.edit(|r| r.hoist(true));

Searches the cache for the guild that owns the role.

Errors

Returns a ModelError::GuildNotFound if a guild is not in the cache that contains the role.

Check that the role has the given permission.

Checks whether the role has all of the given permissions.

The 'precise' argument is used to check if the role's permissions are precisely equivalent to the given permissions. If you need only check that the role has at least the given permissions, pass false.

Trait Implementations

impl Mentionable for Role
[src]

Creates a mentionable string, that will be able to notify and/or create a link to the item. Read more

impl PartialOrd<Role> for Role
[src]

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

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

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

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

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

impl Ord for Role
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl PartialEq<Role> for Role
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl From<Role> for RoleId
[src]

Gets the Id of a role.

impl<'a> From<&'a Role> for RoleId
[src]

Gets the Id of a role.

impl Clone for Role
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for Role
[src]

impl Debug for Role
[src]

Formats the value using the given formatter. Read more

impl Display for Role
[src]

Format a mention for the role, pinging its members.

impl FromStr for Role
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl Serialize for Role
[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for Role
[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl Send for Role

impl Sync for Role

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

Converts the given value to a String. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> UnsafeAny for T where
    T: Any