[][src]Struct serenity::model::id::UserId

pub struct UserId(pub u64);

An identifier for a User

Methods

impl UserId[src]

pub fn created_at(&self) -> NaiveDateTime[src]

Retrieves the time that the Id was created at.

pub fn as_u64(&self) -> &u64[src]

Immutably borrow inner Id.

pub fn as_mut_u64(&mut self) -> &mut u64[src]

Mutably borrow inner Id.

impl UserId[src]

pub fn create_dm_channel(&self) -> Result<PrivateChannel>[src]

Creates a direct message channel between the current user and the user. This can also retrieve the channel if one already exists.

pub fn find(&self) -> Option<Arc<RwLock<User>>>[src]

Deprecated since 0.5.8:

Use the to_user_cached-method instead.

Search the cache for the user with the Id.

pub fn to_user_cached(self) -> Option<Arc<RwLock<User>>>[src]

Attempts to find a User by its Id in the cache.

pub fn get(&self) -> Result<User>[src]

Deprecated since 0.5.8:

Use the to_user-method instead.

Gets a user by its Id from either the cache or the REST API.

Searches the cache for the user first, if the cache is enabled. If the user was not found, then the user is searched via the REST API.

pub fn to_user(self) -> Result<User>[src]

First attempts to find a User by its Id in the cache, upon failure requests it via the REST API.

Note: If the cache is not enabled, REST API will be used only.

Trait Implementations

impl Mentionable for UserId[src]

impl Default for UserId[src]

impl Clone for UserId[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for UserId[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<'a> From<&'a UserId> for UserId[src]

impl From<u64> for UserId[src]

impl From<UserId> for u64[src]

impl From<UserId> for i64[src]

impl From<CurrentUser> for UserId[src]

fn from(current_user: CurrentUser) -> UserId[src]

Gets the Id of a CurrentUser struct.

impl<'a> From<&'a CurrentUser> for UserId[src]

fn from(current_user: &CurrentUser) -> UserId[src]

Gets the Id of a CurrentUser struct.

impl From<Member> for UserId[src]

fn from(member: Member) -> UserId[src]

Gets the Id of a Member.

impl<'a> From<&'a Member> for UserId[src]

fn from(member: &Member) -> UserId[src]

Gets the Id of a Member.

impl From<User> for UserId[src]

fn from(user: User) -> UserId[src]

Gets the Id of a User.

impl<'a> From<&'a User> for UserId[src]

fn from(user: &User) -> UserId[src]

Gets the Id of a User.

impl Eq for UserId[src]

impl Copy for UserId[src]

impl PartialOrd<UserId> for UserId[src]

impl PartialEq<UserId> for UserId[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl PartialEq<u64> for UserId[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl AsRef<UserId> for UserId[src]

impl Display for UserId[src]

impl Debug for UserId[src]

impl FromStr for UserId[src]

type Err = UserIdParseError

The associated error which can be returned from parsing.

impl Hash for UserId[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Serialize for UserId[src]

impl<'de> Deserialize<'de> for UserId[src]

Auto Trait Implementations

impl Send for UserId

impl Sync for UserId

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> UnsafeAny for T where
    T: Any