builder
only.Expand description
A builder to create or edit a Role
for use via a number of model methods.
These are:
PartialGuild::create_role
Guild::create_role
Guild::edit_role
GuildId::create_role
GuildId::edit_role
Role::edit
Defaults are provided for each parameter on role creation.
Examples
Create a hoisted, mentionable role named "a test role"
:
// assuming a `channel_id` and `guild_id` has been bound
let role = guild_id.create_role(&http, |r| r.hoist(true).mentionable(true).name("a test role"));
Tuple Fields
0: HashMap<&'static str, Value>
Implementations
sourceimpl EditRole
impl EditRole
sourcepub fn hoist(&mut self, hoist: bool) -> &mut Self
pub fn hoist(&mut self, hoist: bool) -> &mut Self
Whether or not to hoist the role above lower-positioned role in the user list.
sourcepub fn mentionable(&mut self, mentionable: bool) -> &mut Self
pub fn mentionable(&mut self, mentionable: bool) -> &mut Self
Whether or not to make the role mentionable, notifying its users.
sourcepub fn permissions(&mut self, permissions: Permissions) -> &mut Self
pub fn permissions(&mut self, permissions: Permissions) -> &mut Self
The set of permissions to assign the role.
sourcepub fn position(&mut self, position: u8) -> &mut Self
pub fn position(&mut self, position: u8) -> &mut Self
The position to assign the role in the role list. This correlates to the role’s position in the user list.
sourcepub fn unicode_emoji<S: ToString>(&mut self, unicode_emoji: S) -> &mut Self
pub fn unicode_emoji<S: ToString>(&mut self, unicode_emoji: S) -> &mut Self
The unicode emoji to set as the role image.
sourcepub async fn icon<'a>(
&mut self,
http: impl AsRef<Http>,
icon: impl Into<AttachmentType<'a>>
) -> Result<&mut Self>
Available on crate feature model
only.
pub async fn icon<'a>(
&mut self,
http: impl AsRef<Http>,
icon: impl Into<AttachmentType<'a>>
) -> Result<&mut Self>
model
only.The image to set as the role icon.
Errors
May error if the icon is a URL and the HTTP request fails, or if the icon is a file on a path that doesn’t exist.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for EditRole
impl Send for EditRole
impl Sync for EditRole
impl Unpin for EditRole
impl UnwindSafe for EditRole
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more