pub trait Mention<T> {
// Required method
fn mention(&self) -> MentionFormat<T>;
}Expand description
Mention a resource, such as an emoji or user.
This will create a mention that will link to a user if it exists.
Look at the implementations list to see what you can mention.
§Examples
Mention a channel ID:
use twilight_mention::Mention;
use twilight_model::id::{Id, marker::ChannelMarker};
let id = Id::<ChannelMarker>::new(123);
assert_eq!("<#123>", id.mention().to_string());Required Methods§
Sourcefn mention(&self) -> MentionFormat<T>
fn mention(&self) -> MentionFormat<T>
Mention a resource by using its ID.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Mention<Id<ChannelMarker>> for Channel
Mention a channel. This will format as <#ID>.
impl Mention<Id<ChannelMarker>> for Channel
Mention a channel. This will format as <#ID>.
fn mention(&self) -> MentionFormat<Id<ChannelMarker>>
Source§impl Mention<Id<ChannelMarker>> for Id<ChannelMarker>
Mention a channel ID. This will format as <#ID>.
impl Mention<Id<ChannelMarker>> for Id<ChannelMarker>
Mention a channel ID. This will format as <#ID>.
fn mention(&self) -> MentionFormat<Id<ChannelMarker>>
Source§impl Mention<Id<EmojiMarker>> for Emoji
Mention an emoji. This will format as <:emoji:ID>.
impl Mention<Id<EmojiMarker>> for Emoji
Mention an emoji. This will format as <:emoji:ID>.
fn mention(&self) -> MentionFormat<Id<EmojiMarker>>
Source§impl Mention<Id<EmojiMarker>> for Id<EmojiMarker>
Mention an emoji. This will format as <:emoji:ID>.
impl Mention<Id<EmojiMarker>> for Id<EmojiMarker>
Mention an emoji. This will format as <:emoji:ID>.
fn mention(&self) -> MentionFormat<Id<EmojiMarker>>
Source§impl Mention<Id<RoleMarker>> for Id<RoleMarker>
Mention a role ID. This will format as <@&ID>.
impl Mention<Id<RoleMarker>> for Id<RoleMarker>
Mention a role ID. This will format as <@&ID>.
fn mention(&self) -> MentionFormat<Id<RoleMarker>>
Source§impl Mention<Id<RoleMarker>> for Role
Mention a role ID. This will format as <@&ID>.
impl Mention<Id<RoleMarker>> for Role
Mention a role ID. This will format as <@&ID>.
fn mention(&self) -> MentionFormat<Id<RoleMarker>>
Source§impl Mention<Id<UserMarker>> for CurrentUser
Mention the current user. This will format as <@ID>.
impl Mention<Id<UserMarker>> for CurrentUser
Mention the current user. This will format as <@ID>.
fn mention(&self) -> MentionFormat<Id<UserMarker>>
Source§impl Mention<Id<UserMarker>> for Id<UserMarker>
Mention a user ID. This will format as <&ID>.
impl Mention<Id<UserMarker>> for Id<UserMarker>
Mention a user ID. This will format as <&ID>.
fn mention(&self) -> MentionFormat<Id<UserMarker>>
Source§impl Mention<Id<UserMarker>> for Member
Mention a member’s user. This will format as <@ID>.
impl Mention<Id<UserMarker>> for Member
Mention a member’s user. This will format as <@ID>.
fn mention(&self) -> MentionFormat<Id<UserMarker>>
Source§impl Mention<Id<UserMarker>> for User
Mention a user. This will format as <&ID>.
impl Mention<Id<UserMarker>> for User
Mention a user. This will format as <&ID>.
fn mention(&self) -> MentionFormat<Id<UserMarker>>
Implementors§
impl Mention<CommandMention> for CommandMention
Mention a command.
This will format as:
</NAME:COMMAND_ID>for commands</NAME SUBCOMMAND:ID>for subcommands</NAME SUBCOMMAND_GROUP SUBCOMMAND:ID>for subcommand groups
§Cloning
This implementation uses clone to construct a MentionFormat that owns the
inner CommandMention as mention takes a &self.
The other implementations do this for types that are Copy and therefore do not need to use
clone.
To avoid cloning use CommandMention::into_mention.
impl Mention<Timestamp> for Timestamp
Mention a timestamp. This will format as <t:UNIX> if a style is not
specified or <t:UNIX:STYLE> if a style is specified.