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]

pub fn from_placeholder_and_action_id(
    placeholder: impl Into<Plain>,
    action_id: impl Into<Cow<'a, str>>
) -> Self
[src]

Construct a Select block element from required parts

Arguments

  • placeholder: A [text object 🔗]

Example

See example for Select::from_placeholder_and_action_id

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]

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 >

Auto Trait Implementations

impl<'a> RefUnwindSafe for SelectBuilder<'a>

impl<'a> Send for SelectBuilder<'a>

impl<'a> Sync for SelectBuilder<'a>

impl<'a> Unpin for SelectBuilder<'a>

impl<'a> UnwindSafe for SelectBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.