#[repr(packed(1))]pub struct UserId(/* private fields */);
Expand description
An identifier for a User
Implementations§
source§impl UserId
impl UserId
sourcepub async fn create_dm_channel(
self,
cache_http: impl CacheHttp
) -> Result<PrivateChannel>
Available on crate feature model
only.
pub async fn create_dm_channel( self, cache_http: impl CacheHttp ) -> Result<PrivateChannel>
model
only.Creates a direct message channel between the current user and the user. This can also retrieve the channel if one already exists.
§Errors
Returns Error::Http
if a User
with that UserId
does not exist, or is otherwise
unavailable.
May also return an Error::Json
if there is an error in deserializing the channel data
returned by the Discord API.
sourcepub fn to_user_cached(self, cache: &impl AsRef<Cache>) -> Option<UserRef<'_>>
Available on crate features model
and cache
only.
pub fn to_user_cached(self, cache: &impl AsRef<Cache>) -> Option<UserRef<'_>>
model
and cache
only.Attempts to find a User
by its Id in the cache.
sourcepub async fn to_user(self, cache_http: impl CacheHttp) -> Result<User>
Available on crate feature model
only.
pub async fn to_user(self, cache_http: impl CacheHttp) -> Result<User>
model
only.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.
Note: If the cache is enabled, you might want to enable the temp_cache
feature to
cache user data retrieved by this function for a short duration.
§Errors
May return an Error::Http
if a User
with that UserId
does not exist, or
otherwise cannot be fetched.
May also return an Error::Json
if there is an error in deserializing the user.
Trait Implementations§
source§impl<'de> Deserialize<'de> for UserId
impl<'de> Deserialize<'de> for UserId
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<CommandPermissionId> for UserId
impl From<CommandPermissionId> for UserId
source§fn from(id: CommandPermissionId) -> Self
fn from(id: CommandPermissionId) -> Self
source§impl From<NonZero<u64>> for UserId
impl From<NonZero<u64>> for UserId
source§fn from(id: NonZeroU64) -> UserId
fn from(id: NonZeroU64) -> UserId
source§impl From<UserId> for CommandPermissionId
impl From<UserId> for CommandPermissionId
source§impl From<UserId> for NonZeroI64
impl From<UserId> for NonZeroI64
source§fn from(id: UserId) -> NonZeroI64
fn from(id: UserId) -> NonZeroI64
source§impl From<UserId> for NonZeroU64
impl From<UserId> for NonZeroU64
source§fn from(id: UserId) -> NonZeroU64
fn from(id: UserId) -> NonZeroU64
source§impl Ord for UserId
impl Ord for UserId
source§impl PartialEq for UserId
impl PartialEq for UserId
source§impl PartialOrd for UserId
impl PartialOrd for UserId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for UserId
impl Eq for UserId
impl StructuralPartialEq for UserId
Auto Trait Implementations§
impl RefUnwindSafe for UserId
impl Send for UserId
impl Sync for UserId
impl Unpin for UserId
impl UnwindSafe for UserId
Blanket Implementations§
source§impl<T> ArgumentConvert for Twhere
T: FromStr,
impl<T> ArgumentConvert for Twhere
T: FromStr,
§type Err = <T as FromStr>::Err
type Err = <T as FromStr>::Err
utils
and client
only.source§fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
utils
and client
only.s
as a command parameter of this type.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
source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.