pub struct RichTextSection { /* private fields */ }Expand description
Rich text section element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| elements | Vec<RichTextElementType> | Yes | N/A |
§Example
use slack_messaging::blocks::rich_text::RichTextSection;
use slack_messaging::blocks::rich_text::types::{RichTextElementText, RichTextStyle};
let section = RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Hello there, ")
.build()?
)
.element(
RichTextElementText::builder()
.text("I am a bold rich text block!")
.style(
RichTextStyle::builder()
.bold(true)
.build()?
)
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Hello there, "
},
{
"type": "text",
"text": "I am a bold rich text block!",
"style": {
"bold": true
}
}
]
});
let json = serde_json::to_value(section).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let element = RichTextSection::builder().build();
assert!(element.is_err());Implementations§
Source§impl RichTextSection
impl RichTextSection
Sourcepub fn builder() -> RichTextSectionBuilder
pub fn builder() -> RichTextSectionBuilder
constract RichTextSectionBuilder object.
Trait Implementations§
Source§impl Clone for RichTextSection
impl Clone for RichTextSection
Source§fn clone(&self) -> RichTextSection
fn clone(&self) -> RichTextSection
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 RichTextSection
impl Debug for RichTextSection
Source§impl From<RichTextSection> for RichTextSubElement
impl From<RichTextSection> for RichTextSubElement
Source§fn from(value: RichTextSection) -> Self
fn from(value: RichTextSection) -> Self
Converts to this type from the input type.
Source§impl PartialEq for RichTextSection
impl PartialEq for RichTextSection
Source§fn eq(&self, other: &RichTextSection) -> bool
fn eq(&self, other: &RichTextSection) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RichTextSection
impl Serialize for RichTextSection
impl StructuralPartialEq for RichTextSection
Auto Trait Implementations§
impl Freeze for RichTextSection
impl RefUnwindSafe for RichTextSection
impl Send for RichTextSection
impl Sync for RichTextSection
impl Unpin for RichTextSection
impl UnsafeUnpin for RichTextSection
impl UnwindSafe for RichTextSection
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