Struct slack_blocks::elems::select::public_channel::build::PublicChannelBuilder[][src]

pub struct PublicChannelBuilder<'a, Multi, Placeholder, ActionId> { /* fields omitted */ }
Expand description

PublicChannel Select builder

Allows you to construct a PublicChannel Select safely, with compile-time checks on required setter methods.

Required Methods

PublicChannelBuilder::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::PublicChannel, BlockElement}};

let select: BlockElement =
  PublicChannel::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> PublicChannelBuilder<'a, M, P, A>[src]

pub fn new() -> Self[src]

Construct a new PublicChannelBuilder

pub fn placeholder(
    self,
    text: impl Into<Plain>
) -> PublicChannelBuilder<'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>>
) -> PublicChannelBuilder<'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_ids used elsewhere by your app. Maximum length for this field is 255 characters.

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, M, P, A> PublicChannelBuilder<'a, M, P, A>[src]

pub fn initial_channel<S>(self, channel: S) -> Self where
    S: Into<Cow<'a, str>>, 
[src]

Set initial_channel (Optional)

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.

pub fn initial_channels<S>(self, channels: S) -> Self 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> PublicChannelBuilder<'a, Multi, P, A>[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> PublicChannelBuilder<'a, Single, Set<placeholder>, Set<action_id>>[src]

pub fn build(self) -> PublicChannel<'a>[src]

All done building, now give me a darn select element!

no method name 'build' found for struct 'select::static_::build::PublicChannelBuilder<...>'? Make sure all required setter methods have been called. See docs for PublicChannelBuilder.

use slack_blocks::elems::select::PublicChannel;

let sel = PublicChannel::builder().build(); // Won't compile!
use slack_blocks::elems::select::PublicChannel;

let sel = PublicChannel::builder().placeholder("foo")
                                  .action_id("bar")
                                  .build();

impl<'a> PublicChannelBuilder<'a, Multi, Set<placeholder>, Set<action_id>>[src]

pub fn build(self) -> PublicChannel<'a>[src]

All done building, now give me a darn select element!

no method name 'build' found for struct 'select::static_::build::PublicChannelBuilder<...>'? Make sure all required setter methods have been called. See docs for PublicChannelBuilder.

use slack_blocks::elems::select;

let sel = select::multi::PublicChannel::builder().build(); // Won't compile!
use slack_blocks::elems::select;

let sel = select::multi::PublicChannel::builder().placeholder("foo")
                                                 .action_id("bar")
                                                 .build();

Trait Implementations

impl<'a, Multi: Debug, Placeholder: Debug, ActionId: Debug> Debug for PublicChannelBuilder<'a, Multi, Placeholder, ActionId>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, Multi, Placeholder, ActionId> RefUnwindSafe for PublicChannelBuilder<'a, Multi, Placeholder, ActionId> where
    ActionId: RefUnwindSafe,
    Multi: RefUnwindSafe,
    Placeholder: RefUnwindSafe

impl<'a, Multi, Placeholder, ActionId> Send for PublicChannelBuilder<'a, Multi, Placeholder, ActionId> where
    ActionId: Send,
    Multi: Send,
    Placeholder: Send

impl<'a, Multi, Placeholder, ActionId> Sync for PublicChannelBuilder<'a, Multi, Placeholder, ActionId> where
    ActionId: Sync,
    Multi: Sync,
    Placeholder: Sync

impl<'a, Multi, Placeholder, ActionId> Unpin for PublicChannelBuilder<'a, Multi, Placeholder, ActionId> where
    ActionId: Unpin,
    Multi: Unpin,
    Placeholder: Unpin

impl<'a, Multi, Placeholder, ActionId> UnwindSafe for PublicChannelBuilder<'a, Multi, Placeholder, ActionId> where
    ActionId: UnwindSafe,
    Multi: UnwindSafe,
    Placeholder: UnwindSafe

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.