Struct slack_blocks::elems::select::conversation::build::ConversationBuilder [−][src]
pub struct ConversationBuilder<'a, Multi, Placeholder, ActionId, InitialChannel> { /* fields omitted */ }
Expand description
Conversation Select builder
Allows you to construct a Conversation Select safely, with compile-time checks on required setter methods.
Required Methods
ConversationBuilder::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::Conversation, BlockElement}}; let select: BlockElement = Conversation::builder().placeholder("Choose your favorite channel!") .action_id("favorite_channel") .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, I> ConversationBuilder<'a, M, P, A, I>
[src]
impl<'a, M, P, A, I> ConversationBuilder<'a, M, P, A, I>
[src]pub fn placeholder(
self,
text: impl Into<Plain>
) -> ConversationBuilder<'a, M, Set<placeholder>, A, I>
[src]
pub fn placeholder(
self,
text: impl Into<Plain>
) -> ConversationBuilder<'a, M, Set<placeholder>, A, I>
[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>>
) -> ConversationBuilder<'a, M, P, Set<action_id>, I>
[src]
pub fn action_id(
self,
text: impl Into<Cow<'a, str>>
) -> ConversationBuilder<'a, M, P, Set<action_id>, I>
[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.
pub fn filter(self, filter: ConversationFilter) -> Self
[src]
pub fn filter(self, filter: ConversationFilter) -> Self
[src]Set filter
(Optional)
A filter object 🔗 that defines an optional confirmation dialog that appears after a menu item is selected.
impl<'a, M, P, A> ConversationBuilder<'a, M, P, A, OptionalMethodNotCalled<initial_channel>>
[src]
impl<'a, M, P, A> ConversationBuilder<'a, M, P, A, OptionalMethodNotCalled<initial_channel>>
[src]pub fn initial_channel_current(
self
) -> ConversationBuilder<'a, M, P, A, Set<initial_channel>>
[src]
pub fn initial_channel_current(
self
) -> ConversationBuilder<'a, M, P, A, Set<initial_channel>>
[src]Corresponds to default_to_current_conversation = true
(Optional, exclusive with initial_channel
or initial_channels
)
Pre-populates the select menu with the conversation that the user was viewing when they opened the modal, if available.
Default is false.
impl<'a, P, A> ConversationBuilder<'a, Single, P, A, OptionalMethodNotCalled<initial_channel>>
[src]
impl<'a, P, A> ConversationBuilder<'a, Single, P, A, OptionalMethodNotCalled<initial_channel>>
[src]pub fn initial_channel<S>(
self,
channel: S
) -> ConversationBuilder<'a, Single, P, A, Set<initial_channel>> where
S: Into<Cow<'a, str>>,
[src]
pub fn initial_channel<S>(
self,
channel: S
) -> ConversationBuilder<'a, Single, P, A, Set<initial_channel>> where
S: Into<Cow<'a, str>>,
[src]Set initial_channel
(Optional, exclusive with initial_channel_current
)
The ID of any valid conversation to be pre-selected when the menu loads.
If default_to_current_conversation
is called, this will take precedence.
impl<'a, P, A> ConversationBuilder<'a, Multi, P, A, OptionalMethodNotCalled<initial_channel>>
[src]
impl<'a, P, A> ConversationBuilder<'a, Multi, P, A, OptionalMethodNotCalled<initial_channel>>
[src]pub fn initial_channels<S>(
self,
channels: S
) -> ConversationBuilder<'a, Multi, P, A, Set<initial_channel>> where
S: Into<Cow<'a, [String]>>,
[src]
pub fn initial_channels<S>(
self,
channels: S
) -> ConversationBuilder<'a, Multi, P, A, Set<initial_channel>> where
S: Into<Cow<'a, [String]>>,
[src]Set initial_channel
(Optional, exclusive with initial_channel_current
)
A collection of IDs of any valid conversations to be pre-selected when the menu loads.
impl<'a, P, A, I> ConversationBuilder<'a, Multi, P, A, I>
[src]
impl<'a, P, A, I> ConversationBuilder<'a, Multi, P, A, I>
[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, I> ConversationBuilder<'a, Single, Set<placeholder>, Set<action_id>, I>
[src]
impl<'a, I> ConversationBuilder<'a, Single, Set<placeholder>, Set<action_id>, I>
[src]pub fn build(self) -> Conversation<'a>
[src]
pub fn build(self) -> Conversation<'a>
[src]All done building, now give me a darn select element!
no method name 'build' found for struct 'select::static_::build::ConversationBuilder<...>'
? Make sure all required setter methods have been called. See docs forConversationBuilder
.
use slack_blocks::elems::select::Conversation; let sel = Conversation::builder().build(); // Won't compile!
use slack_blocks::elems::select::Conversation; let sel = Conversation::builder().placeholder("foo") .action_id("bar") .build();
impl<'a, I> ConversationBuilder<'a, Multi, Set<placeholder>, Set<action_id>, I>
[src]
impl<'a, I> ConversationBuilder<'a, Multi, Set<placeholder>, Set<action_id>, I>
[src]pub fn build(self) -> Conversation<'a>
[src]
pub fn build(self) -> Conversation<'a>
[src]All done building, now give me a darn select element!
no method name 'build' found for struct 'select::static_::build::ConversationBuilder<...>'
? Make sure all required setter methods have been called. See docs forConversationBuilder
.
use slack_blocks::elems::select; let sel = select::multi::Conversation::builder().build(); // Won't compile!
use slack_blocks::elems::select; let sel = select::multi::Conversation::builder().placeholder("foo") .action_id("bar") .build();
Trait Implementations
Auto Trait Implementations
impl<'a, Multi, Placeholder, ActionId, InitialChannel> RefUnwindSafe for ConversationBuilder<'a, Multi, Placeholder, ActionId, InitialChannel> where
ActionId: RefUnwindSafe,
InitialChannel: RefUnwindSafe,
Multi: RefUnwindSafe,
Placeholder: RefUnwindSafe,
ActionId: RefUnwindSafe,
InitialChannel: RefUnwindSafe,
Multi: RefUnwindSafe,
Placeholder: RefUnwindSafe,
impl<'a, Multi, Placeholder, ActionId, InitialChannel> Send for ConversationBuilder<'a, Multi, Placeholder, ActionId, InitialChannel> where
ActionId: Send,
InitialChannel: Send,
Multi: Send,
Placeholder: Send,
ActionId: Send,
InitialChannel: Send,
Multi: Send,
Placeholder: Send,
impl<'a, Multi, Placeholder, ActionId, InitialChannel> Sync for ConversationBuilder<'a, Multi, Placeholder, ActionId, InitialChannel> where
ActionId: Sync,
InitialChannel: Sync,
Multi: Sync,
Placeholder: Sync,
ActionId: Sync,
InitialChannel: Sync,
Multi: Sync,
Placeholder: Sync,
impl<'a, Multi, Placeholder, ActionId, InitialChannel> Unpin for ConversationBuilder<'a, Multi, Placeholder, ActionId, InitialChannel> where
ActionId: Unpin,
InitialChannel: Unpin,
Multi: Unpin,
Placeholder: Unpin,
ActionId: Unpin,
InitialChannel: Unpin,
Multi: Unpin,
Placeholder: Unpin,
impl<'a, Multi, Placeholder, ActionId, InitialChannel> UnwindSafe for ConversationBuilder<'a, Multi, Placeholder, ActionId, InitialChannel> where
ActionId: UnwindSafe,
InitialChannel: UnwindSafe,
Multi: UnwindSafe,
Placeholder: UnwindSafe,
ActionId: UnwindSafe,
InitialChannel: UnwindSafe,
Multi: UnwindSafe,
Placeholder: UnwindSafe,