pub struct Input { /* private fields */ }Expand description
Input block representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| label | Text<Plain> | Yes | Max length 2000 characters |
| element | InputElement | Yes | N/A |
| dispatch_action | bool | No | N/A |
| block_id | String | No | Max length 255 characters |
| hint | Text<Plain> | No | Max length 2000 characters |
| optional | bool | No | N/A |
§Example
use slack_messaging::plain_text;
use slack_messaging::blocks::Input;
use slack_messaging::blocks::elements::PlainTextInput;
let input = Input::builder()
.block_id("input_1")
.label(plain_text!("label text")?)
.element(
PlainTextInput::builder()
.action_id("text_area_1")
.multiline(true)
.placeholder(plain_text!("Enter some plain text.")?)
.build()?
)
.optional(true)
.build()?;
let expected = serde_json::json!({
"type": "input",
"block_id": "input_1",
"label": {
"type": "plain_text",
"text": "label text"
},
"element": {
"type": "plain_text_input",
"action_id": "text_area_1",
"multiline": true,
"placeholder": {
"type": "plain_text",
"text": "Enter some plain text."
}
},
"optional": true
});
let json = serde_json::to_value(input).unwrap();
assert_eq!(json, expected);Implementations§
Source§impl Input
impl Input
Sourcepub fn builder() -> InputBuilder
pub fn builder() -> InputBuilder
constract InputBuilder object.
Trait Implementations§
impl StructuralPartialEq for Input
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
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)