pub struct DataTableRow { /* private fields */ }Expand description
Single table row representation being set to the rows field in DataTable
object.
Table rows contain an array of table cells, each represented by
DataTableCell enum.
§Fields and Validations
| Field | Type | Required | Validation |
|---|---|---|---|
| cells | Vec<DataTableCell> | Yes | Maximum of 20 items. |
§Example
use slack_messaging::blocks::RichText;
use slack_messaging::blocks::rich_text::RichTextSection;
use slack_messaging::blocks::rich_text::types::{RichTextElementText, RichTextStyle};
use slack_messaging::blocks::data_table::DataTableRow;
let row = DataTableRow::builder()
.cell("Data Refinement Department")
.cell("MDR")
.cell(
RichText::builder()
.element(
RichTextSection::builder()
.element(
RichTextElementText::builder()
.text("Blue")
.style(
RichTextStyle::builder()
.bold(true)
.build()?
)
.build()?
)
.build()?
)
.build()?
)
.build()?;
let expected = serde_json::json!([
{
"type": "raw_text",
"text": "Data Refinement Department"
},
{
"type": "raw_text",
"text": "MDR"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Blue",
"style": {
"bold": true
}
}
]
}
]
}
]);
let json = serde_json::to_value(row).unwrap();
assert_eq!(json, expected);Implementations§
Source§impl DataTableRow
impl DataTableRow
Sourcepub fn builder() -> DataTableRowBuilder
pub fn builder() -> DataTableRowBuilder
constract DataTableRowBuilder object.
Trait Implementations§
Source§impl Clone for DataTableRow
impl Clone for DataTableRow
Source§fn clone(&self) -> DataTableRow
fn clone(&self) -> DataTableRow
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 DataTableRow
impl Debug for DataTableRow
Source§impl<Cell: Into<DataTableCell>> FromIterator<Cell> for DataTableRow
impl<Cell: Into<DataTableCell>> FromIterator<Cell> for DataTableRow
Source§fn from_iter<T: IntoIterator<Item = Cell>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Cell>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl PartialEq for DataTableRow
impl PartialEq for DataTableRow
Source§fn eq(&self, other: &DataTableRow) -> bool
fn eq(&self, other: &DataTableRow) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DataTableRow
impl Serialize for DataTableRow
impl StructuralPartialEq for DataTableRow
Auto Trait Implementations§
impl Freeze for DataTableRow
impl RefUnwindSafe for DataTableRow
impl Send for DataTableRow
impl Sync for DataTableRow
impl Unpin for DataTableRow
impl UnsafeUnpin for DataTableRow
impl UnwindSafe for DataTableRow
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