pub struct PlainTextInput { /* private fields */ }Expand description
Plain-text input element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| action_id | String | No | Max length 255 characters |
| initial_value | String | No | N/A |
| multiline | bool | No | N/A |
| min_length | i64 | No | Min value 0, Max value 3000 |
| max_length | i64 | No | Min value 1, Max value 3000 |
| dispatch_action_config | DispatchActionConfiguration | No | N/A |
| focus_on_load | bool | No | N/A |
| placeholder | Text<Plain> | No | Max length 150 characters |
§Example
use slack_messaging::plain_text;
use slack_messaging::blocks::elements::PlainTextInput;
let input = PlainTextInput::builder()
.action_id("plain_input")
.multiline(true)
.placeholder(plain_text!("Enter some plain text")?)
.build()?;
let expected = serde_json::json!({
"type": "plain_text_input",
"action_id": "plain_input",
"multiline": true,
"placeholder": {
"type": "plain_text",
"text": "Enter some plain text"
}
});
let json = serde_json::to_value(input).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let input = PlainTextInput::builder()
.action_id("plain_input")
.multiline(true)
.placeholder(plain_text!("{}", "verrrrrrry long text".repeat(100))?)
.build();
assert!(input.is_err());Implementations§
Source§impl PlainTextInput
impl PlainTextInput
Sourcepub fn builder() -> PlainTextInputBuilder
pub fn builder() -> PlainTextInputBuilder
constract PlainTextInputBuilder object.
Trait Implementations§
Source§impl Clone for PlainTextInput
impl Clone for PlainTextInput
Source§fn clone(&self) -> PlainTextInput
fn clone(&self) -> PlainTextInput
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PlainTextInput
impl Debug for PlainTextInput
Source§impl From<PlainTextInput> for InputElement
impl From<PlainTextInput> for InputElement
Source§fn from(value: PlainTextInput) -> Self
fn from(value: PlainTextInput) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PlainTextInput
impl PartialEq for PlainTextInput
Source§impl Serialize for PlainTextInput
impl Serialize for PlainTextInput
impl StructuralPartialEq for PlainTextInput
Auto Trait Implementations§
impl Freeze for PlainTextInput
impl RefUnwindSafe for PlainTextInput
impl Send for PlainTextInput
impl Sync for PlainTextInput
impl Unpin for PlainTextInput
impl UnwindSafe for PlainTextInput
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)