pub struct InputBuilder<'a, Element, Label> { /* private fields */ }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§
Source§impl<'a, E, L> InputBuilder<'a, E, L>
impl<'a, E, L> InputBuilder<'a, E, L>
Sourcepub fn label<T>(self, label: T) -> InputBuilder<'a, E, Set<label>>
pub fn label<T>(self, label: T) -> InputBuilder<'a, E, Set<label>>
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.
Sourcepub fn block_id<S>(self, block_id: S) -> Self
pub fn block_id<S>(self, block_id: S) -> Self
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.
Sourcepub fn dispatch_actions(self, should: bool) -> Self
pub fn dispatch_actions(self, should: bool) -> Self
Set dispatch_action (Optional)
Will allow the elements in this block to dispatch block_actions payloads.
Defaults to false.
Source§impl<'a, L> InputBuilder<'a, RequiredMethodNotCalled<element>, L>
impl<'a, L> InputBuilder<'a, RequiredMethodNotCalled<element>, L>
Sourcepub fn element<El>(self, element: El) -> InputBuilder<'a, Set<element>, L>where
El: Into<SupportedElement<'a>>,
pub fn element<El>(self, element: El) -> InputBuilder<'a, Set<element>, L>where
El: Into<SupportedElement<'a>>,
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.
Sourcepub fn child<El>(self, element: El) -> InputBuilder<'a, Set<element>, L>where
El: Into<SupportedElement<'a>>,
Available on crate feature blox only.
pub fn child<El>(self, element: El) -> InputBuilder<'a, Set<element>, L>where
El: Into<SupportedElement<'a>>,
blox only.XML child alias for element
Source§impl<'a> InputBuilder<'a, Set<element>, Set<label>>
impl<'a> InputBuilder<'a, Set<element>, Set<label>>
Sourcepub fn build(self) -> Input<'a>
pub fn build(self) -> Input<'a>
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 forInputBuilder.
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();