User

Struct User 

Source
pub struct User<'a> {
Show 17 fields pub id: Snowflake, pub username: TitanString<'a>, pub discriminator: TitanString<'a>, pub global_name: Option<TitanString<'a>>, pub avatar: Option<TitanString<'a>>, pub bot: bool, pub system: bool, pub mfa_enabled: Option<bool>, pub banner: Option<TitanString<'a>>, pub accent_color: Option<u32>, pub locale: Option<TitanString<'a>>, pub verified: Option<bool>, pub email: Option<TitanString<'a>>, pub flags: Option<u64>, pub premium_type: Option<u8>, pub public_flags: Option<u64>, pub avatar_decoration_data: Option<Value>,
}
Expand description

Discord User representation.

Fields§

§id: Snowflake

User ID.

§username: TitanString<'a>

Username (not unique per se post-pomelo).

§discriminator: TitanString<'a>

User’s 4-digit Discord tag (deprecated, “0” for pomelo users).

§global_name: Option<TitanString<'a>>

User’s display name.

§avatar: Option<TitanString<'a>>

Avatar hash.

§bot: bool

Whether the user is a bot.

§system: bool

Whether the user is a system user.

§mfa_enabled: Option<bool>

Whether the user has MFA enabled.

§banner: Option<TitanString<'a>>

Banner hash.

§accent_color: Option<u32>

Banner color as integer.

§locale: Option<TitanString<'a>>

User’s locale.

§verified: Option<bool>

Whether email is verified.

§email: Option<TitanString<'a>>

User’s email (requires email scope).

§flags: Option<u64>

User flags.

§premium_type: Option<u8>

Nitro subscription type.

§public_flags: Option<u64>

Public flags on the user.

§avatar_decoration_data: Option<Value>

Avatar decoration data.

Implementations§

Source§

impl User<'_>

Source

pub fn avatar_url(&self) -> Option<String>

Returns the URL of the user’s avatar.

Source

pub fn default_avatar_url(&self) -> String

Returns the URL of the user’s default avatar.

Source

pub fn face(&self) -> String

Returns the user’s displayed avatar URL (avatar or default).

Trait Implementations§

Source§

impl<'a> Clone for User<'a>

Source§

fn clone(&self) -> User<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for User<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de, 'a> Deserialize<'de> for User<'a>

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<User<'a>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Mention for User<'_>

Source§

fn mention(&self) -> String

Returns the mention string for this item (e.g., <@123>).
Source§

impl<'a> Serialize for User<'a>

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for User<'a>

§

impl<'a> RefUnwindSafe for User<'a>

§

impl<'a> Send for User<'a>

§

impl<'a> Sync for User<'a>

§

impl<'a> Unpin for User<'a>

§

impl<'a> UnwindSafe for User<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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