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

Create a new empty builder

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.

Set options (Required)

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

Maximum number of options is 5, minimum is 2.

Append an option to options

Maximum number of options is 5, minimum is 2.

This is supported on crate feature blox only.

Allows using an XML child to append an option.

Set confirm (Optional)

A confirm object 🔗 that defines an optional confirmation dialog that appears after a menu item is selected.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

This is supported on crate feature blox only.

Identity function

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.