Struct slack_blocks::elems::radio::build::RadioBuilder [−][src]
pub struct RadioBuilder<'a, T, A, O> { /* fields omitted */ }
Expand description
Radio Button builder
Allows you to construct a radio button safely, with compile-time checks on required setter methods.
Required Methods
RadioButton::build()
is only available if these methods have been called:
options
action_id
Example
use slack_blocks::{blocks::{Actions, Block}, compose::Opt, elems::Radio}; let options = vec![Opt::builder().text_md(":joy:").value("joy").build(), Opt::builder().text_md(":smirk:").value("smirk").build(),]; let radio = Radio::builder().options(options) .action_id("emoji_picker") .build(); let block: Block = Actions::from_action_elements(std::iter::once(radio.into())).into(); // <send block to slack API>
Implementations
impl<'a, T, A, O> RadioBuilder<'a, T, A, O>
[src]
impl<'a, T, A, O> RadioBuilder<'a, T, A, O>
[src]pub fn action_id<S>(
self,
action_id: S
) -> RadioBuilder<'a, T, Set<action_id>, O> where
S: Into<Cow<'a, str>>,
[src]
pub fn action_id<S>(
self,
action_id: S
) -> RadioBuilder<'a, T, Set<action_id>, O> where
S: Into<Cow<'a, str>>,
[src]Sets action_id
(Required)
An identifier for the action triggered when the radio button group is changed.
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 in the containing block.
Maximum length for this field is 255 characters.
[identify the source of the action 🔗]: https://api.slack.com/interactivity/handling#payloads
pub fn options<I, T2: Into<Text>>(
self,
options: I
) -> RadioBuilder<'a, T2, A, Set<options>> where
I: IntoIterator<Item = Opt<'a, T2, NoUrl>>,
[src]
pub fn options<I, T2: Into<Text>>(
self,
options: I
) -> RadioBuilder<'a, T2, A, Set<options>> where
I: IntoIterator<Item = Opt<'a, T2, NoUrl>>,
[src]Sets options
(Required)
An array of [option objects 🔗].
A maximum of 10 options are allowed. [option objects 🔗]: https://api.slack.com/reference/block-kit/composition-objects#option
pub fn confirm(self, confirm: Confirm) -> Self
[src]
pub fn confirm(self, confirm: Confirm) -> Self
[src]Sets confirm
(Optional)
A confirm object 🔗 that defines an optional confirmation dialog that appears after clicking one of the radio buttons in this element.
impl<'a, A> RadioBuilder<'a, Plain, A, Set<options>>
[src]
impl<'a, A> RadioBuilder<'a, Plain, A, Set<options>>
[src]pub fn initial_option(self, option: Opt<'a, Plain, NoUrl>) -> Self
[src]
pub fn initial_option(self, option: Opt<'a, Plain, NoUrl>) -> Self
[src]Sets initial_option
(Optional)
An option object 🔗 that exactly matches one of the options within options
.
This option will be selected when the radio button group initially loads.
impl<'a, A> RadioBuilder<'a, Mrkdwn, A, Set<options>>
[src]
impl<'a, A> RadioBuilder<'a, Mrkdwn, A, Set<options>>
[src]pub fn initial_option(self, option: Opt<'a, Mrkdwn, NoUrl>) -> Self
[src]
pub fn initial_option(self, option: Opt<'a, Mrkdwn, NoUrl>) -> Self
[src]Sets initial_option
(Optional)
An option object 🔗 that exactly matches one of the options within options
.
This option will be selected when the radio button group initially loads.
impl<'a, T> RadioBuilder<'a, T, Set<action_id>, Set<options>>
[src]
impl<'a, T> RadioBuilder<'a, T, Set<action_id>, Set<options>>
[src]pub fn build(self) -> Radio<'a>
[src]
pub fn build(self) -> Radio<'a>
[src]All done building, now give me a darn radio button group!
no method name 'build' found for struct 'RadioBuilder<...>'
? Make sure all required setter methods have been called. See docs forRadioBuilder
.
use slack_blocks::elems::Radio; let foo = Radio::builder().build(); // Won't compile!
use slack_blocks::{compose::Opt, elems::Radio}; let foo = Radio::builder().action_id("bar") .options(vec![Opt::builder().text_md("foo") .value("bar") .build()]) .build();
Trait Implementations
Auto Trait Implementations
impl<'a, T, A, O> RefUnwindSafe for RadioBuilder<'a, T, A, O> where
A: RefUnwindSafe,
O: RefUnwindSafe,
T: RefUnwindSafe,
A: RefUnwindSafe,
O: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, A, O> Send for RadioBuilder<'a, T, A, O> where
A: Send,
O: Send,
T: Send,
A: Send,
O: Send,
T: Send,
impl<'a, T, A, O> Sync for RadioBuilder<'a, T, A, O> where
A: Sync,
O: Sync,
T: Sync,
A: Sync,
O: Sync,
T: Sync,
impl<'a, T, A, O> Unpin for RadioBuilder<'a, T, A, O> where
A: Unpin,
O: Unpin,
T: Unpin,
A: Unpin,
O: Unpin,
T: Unpin,
impl<'a, T, A, O> UnwindSafe for RadioBuilder<'a, T, A, O> where
A: UnwindSafe,
O: UnwindSafe,
T: UnwindSafe,
A: UnwindSafe,
O: UnwindSafe,
T: UnwindSafe,