pub struct Button<'a> { /* private fields */ }Expand description
§Button
Works with block types:
An interactive component that inserts a button. The button can be a trigger for anything from opening a simple link to starting a complex workflow.
To use interactive components, you will need to make some changes to prepare your app.
Read our guide to enabling interactivity 🔗.
Implementations§
Source§impl<'a> Button<'a>
impl<'a> Button<'a>
Sourcepub fn builder() -> ButtonBuilderInit<'a>
pub fn builder() -> ButtonBuilderInit<'a>
Build a button!
see build::ButtonBuilder for example.
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this Button element agrees with Slack’s model requirements
§Errors
- If
action_idis longer than 255 chars - If
textis longer than 75 chars - If
urlis longer than 3000 chars - If
valueis longer than 2000 chars
§Example
use slack_blocks::elems::Button;
let long_string = std::iter::repeat(' ').take(256).collect::<String>();
let btn = Button::builder().text("Button")
.action_id(long_string)
.build();
assert_eq!(true, matches!(btn.validate(), Err(_)));Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Button<'a>
impl<'de, 'a> Deserialize<'de> for Button<'a>
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> From<Button<'a>> for BlockElement<'a>
impl<'a> From<Button<'a>> for BlockElement<'a>
Source§impl<'a> From<Button<'a>> for SupportedElement<'a>
impl<'a> From<Button<'a>> for SupportedElement<'a>
impl<'a> StructuralPartialEq for Button<'a>
Auto Trait Implementations§
impl<'a> Freeze for Button<'a>
impl<'a> RefUnwindSafe for Button<'a>
impl<'a> Send for Button<'a>
impl<'a> Sync for Button<'a>
impl<'a> Unpin for Button<'a>
impl<'a> UnwindSafe for Button<'a>
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