#[non_exhaustive]pub struct TableRow {
pub cells: Vec<TableCell>,
pub height: Option<HwpUnit>,
pub is_header: bool,
}Expand description
A single row of a table.
§Examples
use hwpforge_core::table::{TableRow, TableCell};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let row = TableRow::new(vec![
TableCell::new(vec![Paragraph::new(ParaShapeIndex::new(0))], HwpUnit::from_mm(50.0).unwrap()),
TableCell::new(vec![Paragraph::new(ParaShapeIndex::new(0))], HwpUnit::from_mm(50.0).unwrap()),
]);
assert_eq!(row.cells.len(), 2);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cells: Vec<TableCell>Cells in this row.
height: Option<HwpUnit>Optional fixed row height. None means auto-height.
is_header: boolWhether this row is part of the table’s leading header-row block.
Implementations§
Source§impl TableRow
impl TableRow
Sourcepub fn new(cells: Vec<TableCell>) -> Self
pub fn new(cells: Vec<TableCell>) -> Self
Creates a new table row with the given cells and auto-calculated height.
§Examples
use hwpforge_core::table::{TableRow, TableCell};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let cell = TableCell::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(40.0).unwrap(),
);
let row = TableRow::new(vec![cell]);
assert!(row.height.is_none());Sourcepub fn with_height(cells: Vec<TableCell>, height: HwpUnit) -> Self
pub fn with_height(cells: Vec<TableCell>, height: HwpUnit) -> Self
Creates a new table row with an explicit fixed height.
§Examples
use hwpforge_core::table::{TableRow, TableCell};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let cell = TableCell::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(40.0).unwrap(),
);
let row = TableRow::with_height(vec![cell], HwpUnit::from_mm(20.0).unwrap());
assert!(row.height.is_some());Sourcepub fn with_header(self, is_header: bool) -> Self
pub fn with_header(self, is_header: bool) -> Self
Marks whether this row belongs to the table’s leading header-row block.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TableRow
impl<'de> Deserialize<'de> for TableRow
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for TableRow
impl JsonSchema for TableRow
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl 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 UnsafeUnpin for TableRow
impl UnwindSafe for TableRow
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