#[non_exhaustive]pub struct Mention {
pub user: User,
pub member: Option<Box<PartialMember>>,
}Expand description
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.user: UserThe mentioned user.
member: Option<Box<PartialMember>>The user’s member in the guild (gateway only).
Implementations§
Methods from Deref<Target = User>§
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Returns the name to display for this user: the global display name if set, otherwise the username.
discord.js counterpart: User#displayName.
Sourcepub fn tag(&self) -> CompactString
pub fn tag(&self) -> CompactString
Returns the user’s tag: username#1234 for legacy users, or just username for users
migrated to unique usernames (discriminator 0).
discord.js counterpart: User#tag.
§Examples
use djs_model::user::User;
let legacy: User = serde_json::from_str(
r#"{"id":"1","username":"nelly","discriminator":"0042","global_name":null,"avatar":null}"#,
)?;
assert_eq!(legacy.tag(), "nelly#0042");Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mention
impl<'de> Deserialize<'de> for Mention
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Mention
impl StructuralPartialEq for Mention
Auto Trait Implementations§
impl Forget for Mention
impl Freeze for Mention
impl Move for Mention
impl RefUnwindSafe for Mention
impl Send for Mention
impl Sync for Mention
impl Unpin for Mention
impl UnsafeUnpin for Mention
impl UnwindSafe for Mention
Blanket Implementations§
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