#[non_exhaustive]pub enum CommandDataOptionValue {
Show 13 variants
Autocomplete {
kind: CommandOptionType,
value: String,
},
Boolean(bool),
Integer(i64),
Number(f64),
String(String),
SubCommand(Vec<CommandDataOption>),
SubCommandGroup(Vec<CommandDataOption>),
Attachment(AttachmentId),
Channel(ChannelId),
Mentionable(GenericId),
Role(RoleId),
User(UserId),
Unknown(u8),
}
Expand description
The value of an CommandDataOption
.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Autocomplete
Boolean(bool)
Integer(i64)
Number(f64)
String(String)
SubCommand(Vec<CommandDataOption>)
SubCommandGroup(Vec<CommandDataOption>)
Attachment(AttachmentId)
Channel(ChannelId)
Mentionable(GenericId)
Role(RoleId)
User(UserId)
Unknown(u8)
Implementations§
Source§impl CommandDataOptionValue
impl CommandDataOptionValue
pub fn kind(&self) -> CommandOptionType
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If the value is a boolean, returns the associated f64. Returns None otherwise.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If the value is an integer, returns the associated f64. Returns None otherwise.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
If the value is a number, returns the associated f64. Returns None otherwise.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
If the value is a string, returns the associated str. Returns None otherwise.
Sourcepub fn as_attachment_id(&self) -> Option<AttachmentId>
pub fn as_attachment_id(&self) -> Option<AttachmentId>
If the value is an AttachmentId
, returns the associated ID. Returns None otherwise.
Sourcepub fn as_channel_id(&self) -> Option<ChannelId>
pub fn as_channel_id(&self) -> Option<ChannelId>
If the value is an ChannelId
, returns the associated ID. Returns None otherwise.
Sourcepub fn as_mentionable(&self) -> Option<GenericId>
pub fn as_mentionable(&self) -> Option<GenericId>
If the value is an GenericId
, returns the associated ID. Returns None otherwise.
Sourcepub fn as_user_id(&self) -> Option<UserId>
pub fn as_user_id(&self) -> Option<UserId>
If the value is an UserId
, returns the associated ID. Returns None otherwise.
Sourcepub fn as_role_id(&self) -> Option<RoleId>
pub fn as_role_id(&self) -> Option<RoleId>
If the value is an RoleId
, returns the associated ID. Returns None otherwise.
Trait Implementations§
Source§impl Clone for CommandDataOptionValue
impl Clone for CommandDataOptionValue
Source§fn clone(&self) -> CommandDataOptionValue
fn clone(&self) -> CommandDataOptionValue
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CommandDataOptionValue
impl Debug for CommandDataOptionValue
Source§impl PartialEq for CommandDataOptionValue
impl PartialEq for CommandDataOptionValue
impl StructuralPartialEq for CommandDataOptionValue
Auto Trait Implementations§
impl Freeze for CommandDataOptionValue
impl RefUnwindSafe for CommandDataOptionValue
impl Send for CommandDataOptionValue
impl Sync for CommandDataOptionValue
impl Unpin for CommandDataOptionValue
impl UnwindSafe for CommandDataOptionValue
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