pub struct TableRow { /* private fields */ }Expand description
Single table row representation being set to the rows field in Table object.
Table rows contain an array of table cells, each represented by
TableCell enum.
§Fields and Validations
| Field | Type | Required | Validation |
|---|---|---|---|
| cells | Vec<TableCell> | Yes | Maximum of 20 items |
§Example
use slack_messaging::blocks::RichText;
use slack_messaging::blocks::rich_text::{types::RichTextElementLink, RichTextSection};
use slack_messaging::blocks::table::TableRow;
let row = TableRow::builder()
.cell("Data 1A")
.cell(
RichText::builder()
.element(
RichTextSection::builder()
.element(
RichTextElementLink::builder()
.url("https://slack.com")
.text("Data 1B")
.build()?
)
.build()?
)
.build()?
)
.build()?;
let expected = serde_json::json!([
{
"type": "raw_text",
"text": "Data 1A"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"text": "Data 1B",
"type": "link",
"url": "https://slack.com"
}
]
}
]
}
]);
let json = serde_json::to_value(row).unwrap();
assert_eq!(json, expected);Implementations§
Source§impl TableRow
impl TableRow
Sourcepub fn builder() -> TableRowBuilder
pub fn builder() -> TableRowBuilder
constract TableRowBuilder object.
Trait Implementations§
Source§impl<Cell: Into<TableCell>> FromIterator<Cell> for TableRow
impl<Cell: Into<TableCell>> FromIterator<Cell> for TableRow
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
impl StructuralPartialEq for TableRow
Auto Trait Implementations§
impl Freeze for TableRow
impl RefUnwindSafe for TableRow
impl Send for TableRow
impl Sync for TableRow
impl Unpin for TableRow
impl UnwindSafe for TableRow
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)