pub struct RichTextPreformatted { /* private fields */ }Expand description
Rich text preformatted element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| elements | Vec<RichTextElementType> | Yes | N/A |
| border | i64 | No | N/A |
| language | String | No | N/A |
§Example
use slack_messaging::blocks::rich_text::prelude::*;
let preformatted = RichTextPreformatted::builder()
.element(
RichTextElementText::builder()
.text("{\n \"object\": {\n \"description\": \"this is an example of a json object\"\n }\n}")
.build()?
)
.border(0)
.build()?;
let expected = serde_json::json!({
"type": "rich_text_preformatted",
"elements": [
{
"type": "text",
"text": "{\n \"object\": {\n \"description\": \"this is an example of a json object\"\n }\n}"
}
],
"border": 0
});
let json = serde_json::to_value(preformatted).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let preformatted = RichTextPreformatted::builder().build();
assert!(preformatted.is_err());Implementations§
Source§impl RichTextPreformatted
impl RichTextPreformatted
Sourcepub fn builder() -> RichTextPreformattedBuilder
pub fn builder() -> RichTextPreformattedBuilder
constract RichTextPreformattedBuilder object.
Trait Implementations§
Source§impl Clone for RichTextPreformatted
impl Clone for RichTextPreformatted
Source§fn clone(&self) -> RichTextPreformatted
fn clone(&self) -> RichTextPreformatted
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RichTextPreformatted
impl Debug for RichTextPreformatted
Source§impl From<RichTextPreformatted> for RichTextSubElement
impl From<RichTextPreformatted> for RichTextSubElement
Source§fn from(value: RichTextPreformatted) -> Self
fn from(value: RichTextPreformatted) -> Self
Converts to this type from the input type.
Source§impl PartialEq for RichTextPreformatted
impl PartialEq for RichTextPreformatted
Source§impl Serialize for RichTextPreformatted
impl Serialize for RichTextPreformatted
impl StructuralPartialEq for RichTextPreformatted
Auto Trait Implementations§
impl Freeze for RichTextPreformatted
impl RefUnwindSafe for RichTextPreformatted
impl Send for RichTextPreformatted
impl Sync for RichTextPreformatted
impl Unpin for RichTextPreformatted
impl UnsafeUnpin for RichTextPreformatted
impl UnwindSafe for RichTextPreformatted
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