pub struct RichTextInput { /* private fields */ }Expand description
Rich text input element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| action_id | String | Yes | Max length 255 characters |
| initial_value | RichText | No | N/A |
| 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::blocks::RichText;
use slack_messaging::blocks::elements::RichTextInput;
use slack_messaging::blocks::rich_text::{RichTextSection, types::RichTextElementText};
let rich_text = RichTextInput::builder()
.action_id("rich_text_input-action")
.initial_value(
RichText::builder()
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Hello")
.build()?
)
.build()?
)
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "rich_text_input",
"action_id": "rich_text_input-action",
"initial_value": {
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Hello"
}
]
}
]
}
});
let json = serde_json::to_value(rich_text).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let rich_text = RichTextInput::builder().build();
assert!(rich_text.is_err());Implementations§
Source§impl RichTextInput
impl RichTextInput
Sourcepub fn builder() -> RichTextInputBuilder
pub fn builder() -> RichTextInputBuilder
constract RichTextInputBuilder object.
Trait Implementations§
Source§impl Clone for RichTextInput
impl Clone for RichTextInput
Source§fn clone(&self) -> RichTextInput
fn clone(&self) -> RichTextInput
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 RichTextInput
impl Debug for RichTextInput
Source§impl From<RichTextInput> for InputElement
impl From<RichTextInput> for InputElement
Source§fn from(value: RichTextInput) -> Self
fn from(value: RichTextInput) -> Self
Converts to this type from the input type.
Source§impl PartialEq for RichTextInput
impl PartialEq for RichTextInput
Source§impl Serialize for RichTextInput
impl Serialize for RichTextInput
impl StructuralPartialEq for RichTextInput
Auto Trait Implementations§
impl Freeze for RichTextInput
impl RefUnwindSafe for RichTextInput
impl Send for RichTextInput
impl Sync for RichTextInput
impl Unpin for RichTextInput
impl UnwindSafe for RichTextInput
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)