Struct slack_blocks::block_elements::select::SelectBuilder [−][src]
pub struct SelectBuilder<'a> {
pub placeholder: Plain,
pub action_id: Cow<'a, str>,
pub confirm: Option<Confirm>,
}Select Element Builder
Use to construct a Select element and easily choose a data source
Fields
placeholder: Plainaction_id: Cow<'a, str>confirm: Option<Confirm>Implementations
impl<'a> SelectBuilder<'a>[src]
impl<'a> SelectBuilder<'a>[src]pub fn from_placeholder_and_action_id(
placeholder: impl Into<Plain>,
action_id: impl Into<Cow<'a, str>>
) -> Self[src]
pub fn from_placeholder_and_action_id(
placeholder: impl Into<Plain>,
action_id: impl Into<Cow<'a, str>>
) -> Self[src]pub fn with_confirm(self, confirm: Confirm) -> Self[src]
pub fn with_confirm(self, confirm: Confirm) -> Self[src]Construct a Select block element from required parts
Arguments
confirm: A confirm object 🔗 that defines an optional confirmation dialog that appears after a menu item is selected.
Example
use std::iter; use slack_blocks::{blocks::actions::Contents as ActionsBlock, block_elements as element, compose::{text, Confirm}}; let confirmation = Confirm::from_parts("Are you sure?", text::Mrkdwn::from("Think hard about this."), "Yes", "No"); let select: element::BlockElement = element::Select::from_placeholder_and_action_id("Pick a channel to delete!", "1234") .with_confirm(confirmation) .choose_from_public_channels() .into(); let block = ActionsBlock::from_elements(iter::once(select)); // < send `block` to slack API >
pub fn choose_from_public_channels(self) -> PublicChannel<'a>[src]
pub fn choose_from_public_channels(self) -> PublicChannel<'a>[src]Turn the builder into a Public Channel select element
Example
use std::iter; use slack_blocks::{blocks::actions::Contents as ActionsBlock, block_elements as element, compose::{text, Confirm}}; let confirmation = Confirm::from_parts("Are you sure?", text::Mrkdwn::from("Think hard about this."), "Yes", "No"); let select: element::BlockElement = element::Select::from_placeholder_and_action_id("Pick a channel to delete!", "1234") .with_confirm(confirmation) .choose_from_public_channels() .into(); let block = ActionsBlock::from_elements(iter::once(select)); // < send `block` to slack API >