pub enum Mention {
Channel(ChannelId),
Role(RoleId),
User(UserId),
}
Expand description
A struct that represents some way to insert a notification, link, or emoji into a message.
Display
is the primary way of utilizing a Mention
, either in a format_args!
type of
macro or with ToString::to_string()
. A Mention
is created using
Mentionable::mention()
, or with From
/Into
.
§Examples
use serenity::model::mention::Mention;
let user = UserId::new(1);
let channel = ChannelId::new(2);
let role = RoleId::new(3);
assert_eq!(
"<@1> <#2> <@&3>",
format!("{} {} {}", Mention::from(user), Mention::from(channel), Mention::from(role),),
)
Variants§
Trait Implementations§
impl Copy for Mention
Auto Trait Implementations§
impl Freeze for Mention
impl RefUnwindSafe for Mention
impl Send for Mention
impl Sync for Mention
impl Unpin for Mention
impl UnwindSafe for Mention
Blanket Implementations§
Source§impl<T> ArgumentConvert for Twhere
T: FromStr,
impl<T> ArgumentConvert for Twhere
T: FromStr,
Source§fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Parses a string
s
as a command parameter of this type.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