pub struct TextInput<'a> { /* private fields */ }Expand description
§Plain Text Input
A plain-text input, similar to the HTML <input> tag, creates a field where a user can enter freeform data.
It can appear as a single-line field or a larger textarea using the multiline flag.
Works in [blocks 🔗]: Input Works in [app surfaces 🔗]: Home tabs, Modals, Messages
Implementations§
Source§impl<'a> TextInput<'a>
impl<'a> TextInput<'a>
Sourcepub fn builder() -> TextInputBuilderInit<'a>
pub fn builder() -> TextInputBuilderInit<'a>
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this select element agrees with Slack’s model requirements
§Errors
- length of
placeholdergreater than 150 - length of
action_idgreater than 255 - value of
min_lengthgreater than 3000
§Example
use slack_blocks::elems::TextInput;
let long_string = || std::iter::repeat('a').take(256).collect::<String>();
let input = TextInput::builder().action_id(long_string())
.placeholder(long_string())
.min_length(3001)
.build();
assert!(matches!(input.validate(), Err(_)))Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for TextInput<'a>
impl<'de, 'a> Deserialize<'de> for TextInput<'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
Source§impl<'a> From<TextInput<'a>> for BlockElement<'a>
impl<'a> From<TextInput<'a>> for BlockElement<'a>
Source§impl<'a> From<TextInput<'a>> for SupportedElement<'a>
impl<'a> From<TextInput<'a>> for SupportedElement<'a>
Source§impl<'a> From<TextInput<'a>> for SupportedElement<'a>
impl<'a> From<TextInput<'a>> for SupportedElement<'a>
impl<'a> StructuralPartialEq for TextInput<'a>
Auto Trait Implementations§
impl<'a> Freeze for TextInput<'a>
impl<'a> RefUnwindSafe for TextInput<'a>
impl<'a> Send for TextInput<'a>
impl<'a> Sync for TextInput<'a>
impl<'a> Unpin for TextInput<'a>
impl<'a> UnwindSafe for TextInput<'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