Struct slack_blocks::elems::overflow::build::OverflowBuilder[][src]

pub struct OverflowBuilder<'a, A, O> { /* fields omitted */ }
Expand description

Overflow Menu Builder

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

Required Methods

OverflowBuilder::build() is only available if these methods have been called:

  • action_id
  • options

Example

use slack_blocks::{elems::Overflow, compose::Opt};

Overflow::builder()
         .action_id("foo")
         .options(vec![
           Opt::builder()
               .text_plain("Open in browser")
               .value("open_ext")
               .url("https://foo.org")
               .build(),
           Opt::builder()
               .text_plain("Do stuff")
               .value("do_stuff")
               .no_url()
               .build(),
         ]);

Implementations

impl<'a, A, O> OverflowBuilder<'a, A, O>[src]

pub fn new() -> Self[src]

Create a new empty builder

pub fn action_id<T>(
    self,
    action_id: T
) -> OverflowBuilder<'a, Set<action_id>, O> where
    T: Into<Cow<'a, str>>, 
[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 in the containing block.

Maximum length for this field is 255 characters.

pub fn options<T>(self, options: T) -> OverflowBuilder<'a, A, Set<options>> where
    T: Into<Cow<'a, [Opt<'a, Plain, AllowUrl>]>>, 
[src]

Set options (Required)

An array of option objects 🔗 to display in the menu.

Maximum number of options is 5, minimum is 2.

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> OverflowBuilder<'a, Set<action_id>, Set<options>>[src]

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

All done building, now give me a darn overflow menu!

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

use slack_blocks::elems::Overflow;

let foo = Overflow::builder().build(); // Won't compile!
use slack_blocks::{compose::Opt, elems::Overflow};

let foo = Overflow::builder().action_id("bar")
                             .options(vec![Opt::builder().text_plain("foo")
                                                         .value("bar")
                                                         .no_url()
                                                         .build()])
                             .build();

Trait Implementations

impl<'a, A: Debug, O: Debug> Debug for OverflowBuilder<'a, A, O>[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, A, O> RefUnwindSafe for OverflowBuilder<'a, A, O> where
    A: RefUnwindSafe,
    O: RefUnwindSafe

impl<'a, A, O> Send for OverflowBuilder<'a, A, O> where
    A: Send,
    O: Send

impl<'a, A, O> Sync for OverflowBuilder<'a, A, O> where
    A: Sync,
    O: Sync

impl<'a, A, O> Unpin for OverflowBuilder<'a, A, O> where
    A: Unpin,
    O: Unpin

impl<'a, A, O> UnwindSafe for OverflowBuilder<'a, A, O> where
    A: UnwindSafe,
    O: 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.