Struct slack_blocks::elems::select::static_::build::StaticBuilder [−][src]
pub struct StaticBuilder<'a, Multi, Placeholder, ActionId, Options> { /* fields omitted */ }
Expand description
Static Select builder
Allows you to construct a Static Select safely, with compile-time checks on required setter methods.
Required Methods
StaticBuilder::build()
is only available if these methods have been called:
placeholder
action_id
options
oroption_groups
NOTE: I’m experimenting with an API that deviates from the from_foo_and_bar
.
If you’re a user of this library, please give me feedback in the repository
as to which pattern you like more. This will most likely be the new builder pattern
for every structure in this crate.
Example
use std::convert::TryFrom; use slack_blocks::{blocks::{Actions, Block}, compose::Opt, elems::{select::Static, BlockElement}}; let rust = Opt::from_plain_text_and_value("Rust", "rs"); let select: BlockElement = Static::builder().placeholder("Choose your favorite programming language!") .options(vec![rust]) .action_id("lang_chosen") .build() .into(); let block: Block = Actions::try_from(select).expect("actions supports select elements") .into(); // <send block to API>
Implementations
impl<'a, M, P, A, O> StaticBuilder<'a, M, P, A, O>
[src]
impl<'a, M, P, A, O> StaticBuilder<'a, M, P, A, O>
[src]pub fn placeholder(
self,
text: impl Into<Plain>
) -> StaticBuilder<'a, M, Set<placeholder>, A, O>
[src]
pub fn placeholder(
self,
text: impl Into<Plain>
) -> StaticBuilder<'a, M, Set<placeholder>, A, O>
[src]Set placeholder
(Required)
A plain_text
only text object 🔗 that defines
the placeholder text shown on the menu.
Maximum length for the text
in this field is 150 characters.
pub fn action_id(
self,
text: impl Into<Cow<'a, str>>
) -> StaticBuilder<'a, M, P, Set<action_id>, O>
[src]
pub fn action_id(
self,
text: impl Into<Cow<'a, str>>
) -> StaticBuilder<'a, M, P, Set<action_id>, O>
[src]Set action_id
(Required)
An identifier for the action triggered when a menu option is selected.
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 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 that appears after a menu item is selected.
impl<'a, P, A, O> StaticBuilder<'a, Multi, P, A, O>
[src]
impl<'a, P, A, O> StaticBuilder<'a, Multi, P, A, O>
[src]pub fn max_selected_items(self, max: u32) -> Self
[src]
pub fn max_selected_items(self, max: u32) -> Self
[src]Set max_selected_items
(Optional)
Specifies the maximum number of items that can be selected in the menu.
Minimum number is 1.
impl<'a, P, A> StaticBuilder<'a, Multi, P, A, Set<(options, StaticOpt<'a>)>>
[src]
impl<'a, P, A> StaticBuilder<'a, Multi, P, A, Set<(options, StaticOpt<'a>)>>
[src]pub fn initial_options<I>(self, options: I) -> Self where
I: IntoIterator<Item = StaticOpt<'a>>,
[src]
pub fn initial_options<I>(self, options: I) -> Self where
I: IntoIterator<Item = StaticOpt<'a>>,
[src]Set initial_options
(Optional)
An array of option objects 🔗 that exactly match one or more of the options within options
.
These options will be selected when the menu initially loads.
impl<'a, P, A> StaticBuilder<'a, Multi, P, A, Set<(options, StaticOpt<'a>)>>
[src]
impl<'a, P, A> StaticBuilder<'a, Multi, P, A, Set<(options, StaticOpt<'a>)>>
[src]pub fn initial_option_groups<I>(self, option_groups: I) -> Self where
I: IntoIterator<Item = StaticOptGroup<'a>>,
[src]
pub fn initial_option_groups<I>(self, option_groups: I) -> Self where
I: IntoIterator<Item = StaticOptGroup<'a>>,
[src]Set initial_options
(Optional)
An array of option objects 🔗 that exactly match one or more of the options within option_groups
.
These options will be selected when the menu initially loads.
impl<'a, P, A> StaticBuilder<'a, Single, P, A, Set<(options, StaticOpt<'a>)>>
[src]
impl<'a, P, A> StaticBuilder<'a, Single, P, A, Set<(options, StaticOpt<'a>)>>
[src]pub fn initial_option(self, option: StaticOpt<'a>) -> Self
[src]
pub fn initial_option(self, option: StaticOpt<'a>) -> Self
[src]Set initial_option
(Optional)
A single option that exactly matches one of the options
that Self::options
was called with.
This option will be selected when the menu initially loads.
impl<'a, P, A> StaticBuilder<'a, Single, P, A, Set<(options, StaticOptGroup<'a>)>>
[src]
impl<'a, P, A> StaticBuilder<'a, Single, P, A, Set<(options, StaticOptGroup<'a>)>>
[src]pub fn initial_option_group(self, option_group: StaticOptGroup<'a>) -> Self
[src]
pub fn initial_option_group(self, option_group: StaticOptGroup<'a>) -> Self
[src]Set initial_option
(Optional)
A single option group that exactly matches one of the option groups
that Self::options
was called with.
This option will be selected when the menu initially loads.
impl<'a, M, P, A, O> StaticBuilder<'a, M, P, A, RequiredMethodNotCalled<O>>
[src]
impl<'a, M, P, A, O> StaticBuilder<'a, M, P, A, RequiredMethodNotCalled<O>>
[src]pub fn options<Iter>(
self,
options: Iter
) -> StaticBuilder<'a, M, P, A, Set<(options, StaticOpt<'a>)>> where
Iter: IntoIterator<Item = StaticOpt<'a>>,
[src]
pub fn options<Iter>(
self,
options: Iter
) -> StaticBuilder<'a, M, P, A, Set<(options, StaticOpt<'a>)>> where
Iter: IntoIterator<Item = StaticOpt<'a>>,
[src]Set options
(this or Self::option_groups
is Required)
An array of option objects 🔗. Maximum number of options is 100.
pub fn option_groups<Iter>(
self,
groups: Iter
) -> StaticBuilder<'a, M, P, A, Set<(options, StaticOptGroup<'a>)>> where
Iter: IntoIterator<Item = StaticOptGroup<'a>>,
[src]
pub fn option_groups<Iter>(
self,
groups: Iter
) -> StaticBuilder<'a, M, P, A, Set<(options, StaticOptGroup<'a>)>> where
Iter: IntoIterator<Item = StaticOptGroup<'a>>,
[src]Set option_groups
(this or Self::options
is Required)
An array of option group objects 🔗. Maximum number of option groups is 100.
impl<'a, O> StaticBuilder<'a, Single, Set<placeholder>, Set<action_id>, Set<O>>
[src]
impl<'a, O> StaticBuilder<'a, Single, Set<placeholder>, Set<action_id>, Set<O>>
[src]pub fn build(self) -> Static<'a>
[src]
pub fn build(self) -> Static<'a>
[src]All done building, now give me a darn select element!
no method name 'build' found for struct 'select::static_::build::StaticBuilder<...>'
? Make sure all required setter methods have been called. See docs forStaticBuilder
.
use slack_blocks::elems::select::Static; let sel = Static::builder().build(); // Won't compile!
use slack_blocks::elems::select::Static; let sel = Static::builder().placeholder("foo") .action_id("bar") .options(vec![]) .build();
impl<'a, O> StaticBuilder<'a, Multi, Set<placeholder>, Set<action_id>, Set<O>>
[src]
impl<'a, O> StaticBuilder<'a, Multi, Set<placeholder>, Set<action_id>, Set<O>>
[src]pub fn build(self) -> Static<'a>
[src]
pub fn build(self) -> Static<'a>
[src]All done building, now give me a darn select element!
no method name 'build' found for struct 'select::static_::build::StaticBuilder<...>'
? Make sure all required setter methods have been called. See docs forStaticBuilder
.
use slack_blocks::elems::select::Static; let sel = Static::builder().build(); // Won't compile!
use slack_blocks::elems::select::Static; let sel = Static::builder().placeholder("foo") .action_id("bar") .options(vec![]) .build();
Trait Implementations
Auto Trait Implementations
impl<'a, Multi, Placeholder, ActionId, Options> RefUnwindSafe for StaticBuilder<'a, Multi, Placeholder, ActionId, Options> where
ActionId: RefUnwindSafe,
Multi: RefUnwindSafe,
Options: RefUnwindSafe,
Placeholder: RefUnwindSafe,
ActionId: RefUnwindSafe,
Multi: RefUnwindSafe,
Options: RefUnwindSafe,
Placeholder: RefUnwindSafe,
impl<'a, Multi, Placeholder, ActionId, Options> Send for StaticBuilder<'a, Multi, Placeholder, ActionId, Options> where
ActionId: Send,
Multi: Send,
Options: Send,
Placeholder: Send,
ActionId: Send,
Multi: Send,
Options: Send,
Placeholder: Send,
impl<'a, Multi, Placeholder, ActionId, Options> Sync for StaticBuilder<'a, Multi, Placeholder, ActionId, Options> where
ActionId: Sync,
Multi: Sync,
Options: Sync,
Placeholder: Sync,
ActionId: Sync,
Multi: Sync,
Options: Sync,
Placeholder: Sync,
impl<'a, Multi, Placeholder, ActionId, Options> Unpin for StaticBuilder<'a, Multi, Placeholder, ActionId, Options> where
ActionId: Unpin,
Multi: Unpin,
Options: Unpin,
Placeholder: Unpin,
ActionId: Unpin,
Multi: Unpin,
Options: Unpin,
Placeholder: Unpin,
impl<'a, Multi, Placeholder, ActionId, Options> UnwindSafe for StaticBuilder<'a, Multi, Placeholder, ActionId, Options> where
ActionId: UnwindSafe,
Multi: UnwindSafe,
Options: UnwindSafe,
Placeholder: UnwindSafe,
ActionId: UnwindSafe,
Multi: UnwindSafe,
Options: UnwindSafe,
Placeholder: UnwindSafe,