pub struct Table {
pub rows: Vec<TableRow>,
pub width: Option<HwpUnit>,
pub caption: Option<Caption>,
}Expand description
A table: a sequence of rows, with optional width and caption.
§Design Decision
No border: Option<BorderStyle> in Phase 1. Border styling is a
Blueprint concern (Phase 2). Core tables are purely structural.
§Examples
use hwpforge_core::table::{Table, TableRow, TableCell};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let table = Table {
rows: vec![TableRow {
cells: vec![TableCell::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(100.0).unwrap(),
)],
height: None,
}],
width: None,
caption: None,
};
assert_eq!(table.row_count(), 1);Fields§
§rows: Vec<TableRow>Rows of the table.
width: Option<HwpUnit>Optional explicit table width. None means auto-width.
caption: Option<Caption>Optional table caption.
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(rows: Vec<TableRow>) -> Self
pub fn new(rows: Vec<TableRow>) -> Self
Creates a table from rows.
§Examples
use hwpforge_core::table::{Table, TableRow};
let table = Table::new(vec![TableRow { cells: vec![], height: None }]);
assert_eq!(table.row_count(), 1);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Table
impl<'de> Deserialize<'de> for Table
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 Table
impl JsonSchema for Table
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 Table
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
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