Struct build_html::TableRow
source · pub struct TableRow { /* private fields */ }
Expand description
A builder for more manual control over individual table elements
Example
let row = TableRow::new()
.with_attributes([("id", "my-row")])
.with_cell(TableCell::new(TableCellType::Header).with_raw("Header"))
.with_cell(TableCell::default().with_raw(1))
.to_html_string();
assert_eq!(row, r#"<tr id="my-row"><th>Header</th><td>1</td></tr>"#);
Implementations§
source§impl TableRow
impl TableRow
sourcepub fn with_attributes<A, S>(self, attributes: A) -> Selfwhere
A: IntoIterator<Item = (S, S)>,
S: ToString,
pub fn with_attributes<A, S>(self, attributes: A) -> Selfwhere A: IntoIterator<Item = (S, S)>, S: ToString,
Set the attributes for this row.
Note that this operation overrides all previous invocations of with_attributes
.
Example
let out = TableRow::new()
.with_attributes([("id", "first-row"), ("class", "table-rows")])
.with_cell(TableCell::default())
.to_html_string();
assert_eq!(out, r#"<tr id="first-row" class="table-rows"><td></td></tr>"#);