pub struct RichTextList { /* private fields */ }Expand description
Rich text list element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| style | ListStyle | Yes | N/A |
| elements | Vec<RichTextSection> | Yes | N/A |
| indent | i64 | No | N/A |
| offset | i64 | No | N/A |
| border | i64 | No | N/A |
§Example
use slack_messaging::blocks::rich_text::prelude::*;
let list = RichTextList::builder()
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Huddles")
.build()?
)
.build()?
)
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Canvas")
.build()?
)
.build()?
)
.style(ListStyle::Bullet)
.indent(0)
.border(1)
.build()?;
let expected = serde_json::json!({
"type": "rich_text_list",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Huddles",
}
]
},
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Canvas",
}
]
}
],
"style": "bullet",
"indent": 0,
"border": 1
});
let json = serde_json::to_value(list).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let list = RichTextList::builder().build();
assert!(list.is_err());Implementations§
Source§impl RichTextList
impl RichTextList
Sourcepub fn builder() -> RichTextListBuilder
pub fn builder() -> RichTextListBuilder
constract RichTextListBuilder object.
Trait Implementations§
Source§impl Clone for RichTextList
impl Clone for RichTextList
Source§fn clone(&self) -> RichTextList
fn clone(&self) -> RichTextList
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 RichTextList
impl Debug for RichTextList
Source§impl From<RichTextList> for RichTextSubElement
impl From<RichTextList> for RichTextSubElement
Source§fn from(value: RichTextList) -> Self
fn from(value: RichTextList) -> Self
Converts to this type from the input type.
Source§impl PartialEq for RichTextList
impl PartialEq for RichTextList
Source§impl Serialize for RichTextList
impl Serialize for RichTextList
impl StructuralPartialEq for RichTextList
Auto Trait Implementations§
impl Freeze for RichTextList
impl RefUnwindSafe for RichTextList
impl Send for RichTextList
impl Sync for RichTextList
impl Unpin for RichTextList
impl UnsafeUnpin for RichTextList
impl UnwindSafe for RichTextList
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