Struct slack_blocks::elems::button::build::ButtonBuilder [−][src]
pub struct ButtonBuilder<'a, Text, ActionId> { /* fields omitted */ }
Expand description
Button Builder
Allows you to construct safely, with compile-time checks on required setter methods.
Required Methods
ButtonBuilder::build()
is only available if these methods have been called:
action_id
text
use std::convert::TryFrom; use slack_blocks::{blocks, elems}; let button: elems::BlockElement = elems::Button::builder().text("do stuff!") .action_id("stuff") .build() .into(); let block: blocks::Block = blocks::Actions::try_from(button).expect("Actions block supports buttons") .into();
Implementations
impl<'a, T, A> ButtonBuilder<'a, T, A>
[src]
impl<'a, T, A> ButtonBuilder<'a, T, A>
[src]pub fn style(self, style: Style) -> Self
[src]
pub fn style(self, style: Style) -> Self
[src]Set style
(Optional)
Decorates buttons with alternative visual color schemes.
Use this option with restraint.
If this method is not called, the default button style will be used.
pub fn confirm(self, confirm: Confirm) -> Self
[src]
pub fn confirm(self, confirm: Confirm) -> Self
[src]Set confirm
(Optional)
A confirm object 🔗 that defines an optional confirmation dialog after the button is clicked.
pub fn value(self, value: impl Into<Cow<'a, str>>) -> Self
[src]
pub fn value(self, value: impl Into<Cow<'a, str>>) -> Self
[src]Set value
(Optional)
Add a meaningful value to send back to your app when this button is clicked.
Maximum length for this field is 2000 characters.
pub fn action_id(
self,
action_id: impl Into<Cow<'a, str>>
) -> ButtonBuilder<'a, T, Set<action_id>>
[src]
pub fn action_id(
self,
action_id: impl Into<Cow<'a, str>>
) -> ButtonBuilder<'a, T, Set<action_id>>
[src]Set action_id
(Required)
An identifier for this action.
You can use this when you receive an interaction payload to identify the source of the action 🔗.
Should be unique among all other action_id
s used elsewhere by your app.
Maximum length for this field is 255 characters.
pub fn text(self, text: impl Into<Plain>) -> ButtonBuilder<'a, Set<text>, A>
[src]
pub fn text(self, text: impl Into<Plain>) -> ButtonBuilder<'a, Set<text>, A>
[src]Set text
(Required)
A plain text object 🔗 that defines the button’s text.
Maximum length for the text in this field is 75 characters.
impl<'a> ButtonBuilder<'a, Set<text>, Set<action_id>>
[src]
impl<'a> ButtonBuilder<'a, Set<text>, Set<action_id>>
[src]pub fn build(self) -> Button<'a>
[src]
pub fn build(self) -> Button<'a>
[src]All done building, now give me a darn button!
no method name 'build' found for struct 'ButtonBuilder<...>'
? Make sure all required setter methods have been called. See docs forButtonBuilder
.
use slack_blocks::elems::Button; let foo = Button::builder().build(); // Won't compile!
use slack_blocks::{compose::Opt, elems::Button}; let foo = Button::builder().action_id("foo").text("Do foo").build();
Trait Implementations
Auto Trait Implementations
impl<'a, Text, ActionId> RefUnwindSafe for ButtonBuilder<'a, Text, ActionId> where
ActionId: RefUnwindSafe,
Text: RefUnwindSafe,
ActionId: RefUnwindSafe,
Text: RefUnwindSafe,
impl<'a, Text, ActionId> Send for ButtonBuilder<'a, Text, ActionId> where
ActionId: Send,
Text: Send,
ActionId: Send,
Text: Send,
impl<'a, Text, ActionId> Sync for ButtonBuilder<'a, Text, ActionId> where
ActionId: Sync,
Text: Sync,
ActionId: Sync,
Text: Sync,
impl<'a, Text, ActionId> Unpin for ButtonBuilder<'a, Text, ActionId> where
ActionId: Unpin,
Text: Unpin,
ActionId: Unpin,
Text: Unpin,
impl<'a, Text, ActionId> UnwindSafe for ButtonBuilder<'a, Text, ActionId> where
ActionId: UnwindSafe,
Text: UnwindSafe,
ActionId: UnwindSafe,
Text: UnwindSafe,