pub struct Input<'a> { /* private fields */ }Expand description
§Input Block
A block that collects information from users -
Read slack’s guide to using modals 🔗 to learn how input blocks pass information to your app.
Implementations§
Source§impl<'a> Input<'a>
impl<'a> Input<'a>
Sourcepub fn builder() -> InputBuilderInit<'a>
pub fn builder() -> InputBuilderInit<'a>
Build a new input block
For example, see blocks::input::build::InputBuilder.
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this Input block agrees with Slack’s model requirements
§Errors
- If
from_label_and_elementwas passed a Text object longer than 2000 chars - If
hintlonger than 2000 chars - If
block_idlonger than 256 chars
§Example
use slack_blocks::{blocks, elems::select};
let select =
select::PublicChannel::builder().placeholder("Pick a channel...")
.action_id("ABC123")
.build();
let long_string = std::iter::repeat(' ').take(2001).collect::<String>();
let block = blocks::Input
::builder()
.label("On a scale from 1 - 5, how angsty are you?")
.element(select)
.block_id(long_string)
.build();
assert_eq!(true, matches!(block.validate(), Err(_)));
// < send to slack API >Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Input<'a>
impl<'de, 'a> Deserialize<'de> for Input<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> StructuralPartialEq for Input<'a>
Auto Trait Implementations§
impl<'a> Freeze for Input<'a>
impl<'a> RefUnwindSafe for Input<'a>
impl<'a> Send for Input<'a>
impl<'a> Sync for Input<'a>
impl<'a> Unpin for Input<'a>
impl<'a> UnwindSafe for Input<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more