Struct slack_blocks::elems::select::user::build::UserBuilder [−][src]
pub struct UserBuilder<'a, Multi, Placeholder, ActionId> { /* fields omitted */ }
Expand description
User Select builder
Allows you to construct a User Select safely, with compile-time checks on required setter methods.
Required Methods
UserBuilder::build()
is only available if these methods have been called:
placeholder
action_id
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::User, BlockElement}}; let select: BlockElement = User::builder().placeholder("Choose your favorite co-worker!") .action_id("favorite_coworker") .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> UserBuilder<'a, M, P, A>
[src]
impl<'a, M, P, A> UserBuilder<'a, M, P, A>
[src]pub fn placeholder(
self,
text: impl Into<Plain>
) -> UserBuilder<'a, M, Set<placeholder>, A>
[src]
pub fn placeholder(
self,
text: impl Into<Plain>
) -> UserBuilder<'a, M, Set<placeholder>, A>
[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>>
) -> UserBuilder<'a, M, P, Set<action_id>>
[src]
pub fn action_id(
self,
text: impl Into<Cow<'a, str>>
) -> UserBuilder<'a, M, P, Set<action_id>>
[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> UserBuilder<'a, Single, P, A>
[src]
impl<'a, P, A> UserBuilder<'a, Single, P, A>
[src]pub fn initial_user<S>(self, user: S) -> Self where
S: Into<Cow<'a, str>>,
[src]
pub fn initial_user<S>(self, user: S) -> Self where
S: Into<Cow<'a, str>>,
[src]Set initial_user
(Optional)
The user ID of any valid user to be pre-selected when the menu loads.
impl<'a, P, A> UserBuilder<'a, Multi, P, A>
[src]
impl<'a, P, A> UserBuilder<'a, Multi, P, A>
[src]pub fn initial_users<S>(self, users: S) -> Self where
S: Into<Cow<'a, [String]>>,
[src]
pub fn initial_users<S>(self, users: S) -> Self where
S: Into<Cow<'a, [String]>>,
[src]Set initial_users
(Optional)
A collection of user IDs of any valid users to be pre-selected when the menu loads.
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> UserBuilder<'a, Single, Set<placeholder>, Set<action_id>>
[src]
impl<'a> UserBuilder<'a, Single, Set<placeholder>, Set<action_id>>
[src]pub fn build(self) -> User<'a>
[src]
pub fn build(self) -> User<'a>
[src]All done building, now give me a darn select element!
no method name 'build' found for struct 'select::static_::build::UserBuilder<...>'
? Make sure all required setter methods have been called. See docs forUserBuilder
.
use slack_blocks::elems::select::User; let sel = User::builder().build(); // Won't compile!
use slack_blocks::elems::select::User; let sel = User::builder().placeholder("foo").action_id("bar").build();
impl<'a> UserBuilder<'a, Multi, Set<placeholder>, Set<action_id>>
[src]
impl<'a> UserBuilder<'a, Multi, Set<placeholder>, Set<action_id>>
[src]pub fn build(self) -> User<'a>
[src]
pub fn build(self) -> User<'a>
[src]All done building, now give me a darn select element!
no method name 'build' found for struct 'select::static_::build::UserBuilder<...>'
? Make sure all required setter methods have been called. See docs forUserBuilder
.
use slack_blocks::elems::select; let sel = select::multi::User::builder().build(); // Won't compile!
use slack_blocks::elems::select; let sel = select::multi::User::builder().placeholder("foo") .action_id("bar") .build();
Trait Implementations
Auto Trait Implementations
impl<'a, Multi, Placeholder, ActionId> RefUnwindSafe for UserBuilder<'a, Multi, Placeholder, ActionId> where
ActionId: RefUnwindSafe,
Multi: RefUnwindSafe,
Placeholder: RefUnwindSafe,
ActionId: RefUnwindSafe,
Multi: RefUnwindSafe,
Placeholder: RefUnwindSafe,
impl<'a, Multi, Placeholder, ActionId> Send for UserBuilder<'a, Multi, Placeholder, ActionId> where
ActionId: Send,
Multi: Send,
Placeholder: Send,
ActionId: Send,
Multi: Send,
Placeholder: Send,
impl<'a, Multi, Placeholder, ActionId> Sync for UserBuilder<'a, Multi, Placeholder, ActionId> where
ActionId: Sync,
Multi: Sync,
Placeholder: Sync,
ActionId: Sync,
Multi: Sync,
Placeholder: Sync,
impl<'a, Multi, Placeholder, ActionId> Unpin for UserBuilder<'a, Multi, Placeholder, ActionId> where
ActionId: Unpin,
Multi: Unpin,
Placeholder: Unpin,
ActionId: Unpin,
Multi: Unpin,
Placeholder: Unpin,
impl<'a, Multi, Placeholder, ActionId> UnwindSafe for UserBuilder<'a, Multi, Placeholder, ActionId> where
ActionId: UnwindSafe,
Multi: UnwindSafe,
Placeholder: UnwindSafe,
ActionId: UnwindSafe,
Multi: UnwindSafe,
Placeholder: UnwindSafe,