Struct serenity::model::id::UserId [−][src]
pub struct UserId(pub u64);
An identifier for a User
Methods
impl UserId
[src]
impl UserId
pub fn created_at(&self) -> NaiveDateTime
[src]
pub fn created_at(&self) -> NaiveDateTime
Retrieves the time that the Id was created at.
impl UserId
[src]
impl UserId
pub fn create_dm_channel(&self) -> Result<PrivateChannel>
[src]
pub fn create_dm_channel(&self) -> Result<PrivateChannel>
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]
pub fn find(&self) -> Option<Arc<RwLock<User>>>
Search the cache for the user with the Id.
pub fn get(&self) -> Result<User>
[src]
pub fn get(&self) -> Result<User>
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.
Trait Implementations
impl Copy for UserId
[src]
impl Copy for UserId
impl Clone for UserId
[src]
impl Clone for UserId
fn clone(&self) -> UserId
[src]
fn clone(&self) -> UserId
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for UserId
[src]
impl Default for UserId
impl Debug for UserId
[src]
impl Debug for UserId
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for UserId
[src]
impl Eq for UserId
impl Hash for UserId
[src]
impl Hash for UserId
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialOrd for UserId
[src]
impl PartialOrd for UserId
fn partial_cmp(&self, other: &UserId) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &UserId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &UserId) -> bool
[src]
fn lt(&self, other: &UserId) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &UserId) -> bool
[src]
fn le(&self, other: &UserId) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &UserId) -> bool
[src]
fn gt(&self, other: &UserId) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &UserId) -> bool
[src]
fn ge(&self, other: &UserId) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for UserId
[src]
impl Ord for UserId
fn cmp(&self, other: &UserId) -> Ordering
[src]
fn cmp(&self, other: &UserId) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl AsRef<UserId> for UserId
[src]
impl AsRef<UserId> for UserId
impl<'a> From<&'a UserId> for UserId
[src]
impl<'a> From<&'a UserId> for UserId
impl From<u64> for UserId
[src]
impl From<u64> for UserId
impl PartialEq for UserId
[src]
impl PartialEq for UserId
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<u64> for UserId
[src]
impl PartialEq<u64> for UserId
fn eq(&self, u: &u64) -> bool
[src]
fn eq(&self, u: &u64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Display for UserId
[src]
impl Display for UserId
fn fmt(&self, f: &mut Formatter) -> FmtResult
[src]
fn fmt(&self, f: &mut Formatter) -> FmtResult
Formats the value using the given formatter. Read more
impl<'de> Deserialize<'de> for UserId
[src]
impl<'de> Deserialize<'de> for UserId
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Mentionable for UserId
[src]
impl Mentionable for UserId
fn mention(&self) -> String
[src]
fn mention(&self) -> String
Creates a mentionable string, that will be able to notify and/or create a link to the item. Read more
impl FromStr for UserId
[src]
impl FromStr for UserId
type Err = UserIdParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> StdResult<Self, Self::Err>
[src]
fn from_str(s: &str) -> StdResult<Self, Self::Err>
Parses a string s
to return a value of this type. Read more
impl From<CurrentUser> for UserId
[src]
impl From<CurrentUser> for UserId
fn from(current_user: CurrentUser) -> UserId
[src]
fn from(current_user: CurrentUser) -> UserId
Gets the Id of a CurrentUser
struct.
impl<'a> From<&'a CurrentUser> for UserId
[src]
impl<'a> From<&'a CurrentUser> for UserId
fn from(current_user: &CurrentUser) -> UserId
[src]
fn from(current_user: &CurrentUser) -> UserId
Gets the Id of a CurrentUser
struct.
impl From<Member> for UserId
[src]
impl From<Member> for UserId
impl<'a> From<&'a Member> for UserId
[src]
impl<'a> From<&'a Member> for UserId
impl From<User> for UserId
[src]
impl From<User> for UserId
impl<'a> From<&'a User> for UserId
[src]
impl<'a> From<&'a User> for UserId