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::builder().element(radio).build().into(); // <send block to slack API>
Implementations
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.
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]Append an option to options
A maximum of 10 options are allowed.
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.
pub fn child<T2: Into<Text>>(
self,
opt: Opt<'a, T2, NoUrl>
) -> RadioBuilder<'a, T2, A, Set<options>>
[src]This is supported on crate feature blox
only.
pub fn child<T2: Into<Text>>(
self,
opt: Opt<'a, T2, NoUrl>
) -> RadioBuilder<'a, T2, A, Set<options>>
[src]blox
only.Allows using XML children to append options to the group.
Sets confirm
(Optional)
A confirm object 🔗 that defines an optional confirmation dialog that appears after clicking one of the radio buttons in this element.
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,
impl<'a, T, A, O> Send for RadioBuilder<'a, T, A, O> where
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,
impl<'a, T, A, O> Unpin for RadioBuilder<'a, T, A, O> where
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,