pub struct TableRow {
pub cells: Vec<TableCell>,
pub height: Option<HwpUnit>,
}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 {
cells: 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()),
],
height: None,
};
assert_eq!(row.cells.len(), 2);Fields§
§cells: Vec<TableCell>Cells in this row.
height: Option<HwpUnit>Optional fixed row height. None means auto-height.
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());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 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