Struct slack_blocks::blocks::input::build::InputBuilder[][src]

pub struct InputBuilder<'a, Element, Label> { /* fields omitted */ }
Expand description

Build an Input block

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

Required Methods

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

  • element

Example

use slack_blocks::{blocks::Input,
                   compose::text::ToSlackPlaintext,
                   elems::TextInput};

let block =
  Input::builder().label("foo".plaintext())
                  .element(TextInput::builder().action_id("foo").build())
                  .build();

Implementations

impl<'a, E, L> InputBuilder<'a, E, L>[src]

pub fn new() -> Self[src]

Create a new InputBuilder

pub fn element<El>(self, element: El) -> InputBuilder<'a, Set<element>, L> where
    El: Into<SupportedElement<'a>>, 
[src]

Set element (Required)

An interactive block_element that will be used to gather the input for this block.

For the kinds of Elements supported by Input blocks, see the SupportedElement enum.

pub fn label<T>(self, label: T) -> InputBuilder<'a, E, Set<label>> where
    T: Into<Plain>, 
[src]

Set label (Required)

A label that appears above an input element in the form of a text object 🔗 that must have type of plain_text.

Maximum length for the text in this field is 2000 characters.

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

Set block_id (Optional)

A string acting as a unique identifier for a block.

You can use this block_id when you receive an interaction payload to identify the source of the action 🔗.

If not specified, a block_id will be generated.

Maximum length for this field is 255 characters.

impl<'a> InputBuilder<'a, Set<element>, Set<label>>[src]

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

All done building, now give me a darn actions block!

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

use slack_blocks::blocks::Input;

let foo = Input::builder().build(); // Won't compile!
use slack_blocks::{blocks::Input,
                   compose::text::ToSlackPlaintext,
                   elems::TextInput};

let block =
  Input::builder().label("foo".plaintext())
                  .element(TextInput::builder().action_id("foo").build())
                  .build();

Trait Implementations

impl<'a, Element: Debug, Label: Debug> Debug for InputBuilder<'a, Element, Label>[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, Element, Label> RefUnwindSafe for InputBuilder<'a, Element, Label> where
    Element: RefUnwindSafe,
    Label: RefUnwindSafe

impl<'a, Element, Label> Send for InputBuilder<'a, Element, Label> where
    Element: Send,
    Label: Send

impl<'a, Element, Label> Sync for InputBuilder<'a, Element, Label> where
    Element: Sync,
    Label: Sync

impl<'a, Element, Label> Unpin for InputBuilder<'a, Element, Label> where
    Element: Unpin,
    Label: Unpin

impl<'a, Element, Label> UnwindSafe for InputBuilder<'a, Element, Label> where
    Element: UnwindSafe,
    Label: 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.