pub struct CreateButton(/* private fields */);
Expand description
A builder for creating a button component in a message
Implementations§
Source§impl CreateButton
impl CreateButton
Sourcepub fn new_link(url: impl Into<String>) -> Self
pub fn new_link(url: impl Into<String>) -> Self
Creates a link button to the given URL. You must also set Self::label
and/or
Self::emoji
after this.
Clicking this button will not trigger an interaction event in your bot.
Creates a new premium button associated with the given SKU.
Clicking this button will not trigger an interaction event in your bot.
Sourcepub fn new(custom_id: impl Into<String>) -> Self
pub fn new(custom_id: impl Into<String>) -> Self
Creates a normal button with the given custom ID. You must also set Self::label
and/or
Self::emoji
after this.
Sourcepub fn custom_id(self, id: impl Into<String>) -> Self
pub fn custom_id(self, id: impl Into<String>) -> Self
Sets the custom id of the button, a developer-defined identifier. Replaces the current
value as set in Self::new
.
Has no effect on link buttons and premium buttons.
Sourcepub fn style(self, new_style: ButtonStyle) -> Self
pub fn style(self, new_style: ButtonStyle) -> Self
Sets the style of this button.
Has no effect on link buttons and premium buttons.
Sourcepub fn emoji(self, emoji: impl Into<ReactionType>) -> Self
pub fn emoji(self, emoji: impl Into<ReactionType>) -> Self
Sets emoji of the button.
Trait Implementations§
Source§impl Clone for CreateButton
impl Clone for CreateButton
Source§fn clone(&self) -> CreateButton
fn clone(&self) -> CreateButton
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 CreateButton
impl Debug for CreateButton
Source§impl From<Button> for CreateButton
impl From<Button> for CreateButton
Source§impl PartialEq for CreateButton
impl PartialEq for CreateButton
Source§impl Serialize for CreateButton
impl Serialize for CreateButton
impl StructuralPartialEq for CreateButton
Auto Trait Implementations§
impl Freeze for CreateButton
impl RefUnwindSafe for CreateButton
impl Send for CreateButton
impl Sync for CreateButton
impl Unpin for CreateButton
impl UnwindSafe for CreateButton
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