#[non_exhaustive]pub enum Button {
Interactive(InteractiveButton),
Link(LinkButton),
Premium(PremiumButton),
Unknown(Box<UnknownButton>),
}Expand description
A button, in an action row or as a section accessory (messages only).
Its style decides which fields it has (D-066). Link and premium buttons do not send an
interaction when clicked.
discord.js counterpart: ButtonComponent / ButtonBuilder.
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.
Interactive(InteractiveButton)
A button with a custom_id that sends an interaction (styles 1-4).
Link(LinkButton)
A button that opens a URL (style 5).
Premium(PremiumButton)
A button that opens the purchase of an SKU (style 6).
Unknown(Box<UnknownButton>)
A button style this version of the library does not know about (boxed: it keeps every button field).
Implementations§
Source§impl Button
impl Button
Sourcepub const fn id(&self) -> Option<i32>
pub const fn id(&self) -> Option<i32>
Returns the component’s numeric identifier, if set.
discord.js counterpart: ButtonComponent#id.
Sourcepub const fn style(&self) -> ButtonStyle
pub const fn style(&self) -> ButtonStyle
Returns the button’s style.
discord.js counterpart: ButtonComponent#style.
Trait Implementations§
impl Eq for Button
Source§impl From<InteractiveButton> for Button
impl From<InteractiveButton> for Button
Source§fn from(button: InteractiveButton) -> Self
fn from(button: InteractiveButton) -> Self
Converts to this type from the input type.
Source§impl From<LinkButton> for Button
impl From<LinkButton> for Button
Source§fn from(button: LinkButton) -> Self
fn from(button: LinkButton) -> Self
Converts to this type from the input type.
Source§impl From<PremiumButton> for Button
impl From<PremiumButton> for Button
Source§fn from(button: PremiumButton) -> Self
fn from(button: PremiumButton) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Button
Auto Trait Implementations§
impl Forget for Button
impl Freeze for Button
impl Move for Button
impl RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl UnsafeUnpin for Button
impl UnwindSafe for Button
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