#[non_exhaustive]pub struct Table {
pub rows: Vec<TableRow>,
pub width: Option<HwpUnit>,
pub caption: Option<Caption>,
pub page_break: TablePageBreak,
pub repeat_header: bool,
pub cell_spacing: Option<HwpUnit>,
pub border_fill_id: Option<u32>,
}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, TableCell, TablePageBreak, TableRow};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let table = Table::new(vec![TableRow::new(vec![TableCell::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(100.0).unwrap(),
)])])
.with_page_break(TablePageBreak::Cell);
assert_eq!(table.row_count(), 1);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.rows: Vec<TableRow>Rows of the table.
width: Option<HwpUnit>Optional explicit table width. None means auto-width.
caption: Option<Caption>Optional table caption.
page_break: TablePageBreakPage-break policy for this table.
repeat_header: boolWhether the first row repeats across page breaks.
cell_spacing: Option<HwpUnit>Optional explicit spacing between table cells.
border_fill_id: Option<u32>Optional table-level border/fill reference.
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::new(vec![])]);
assert_eq!(table.row_count(), 1);Sourcepub fn with_width(self, width: HwpUnit) -> Self
pub fn with_width(self, width: HwpUnit) -> Self
Sets an explicit table width.
Sourcepub fn with_caption(self, caption: Caption) -> Self
pub fn with_caption(self, caption: Caption) -> Self
Attaches a table caption.
Sourcepub fn with_page_break(self, page_break: TablePageBreak) -> Self
pub fn with_page_break(self, page_break: TablePageBreak) -> Self
Sets the page-break policy for this table.
Sourcepub fn with_repeat_header(self, repeat_header: bool) -> Self
pub fn with_repeat_header(self, repeat_header: bool) -> Self
Controls whether the leading header block repeats across page breaks.
Sourcepub fn with_cell_spacing(self, cell_spacing: HwpUnit) -> Self
pub fn with_cell_spacing(self, cell_spacing: HwpUnit) -> Self
Sets the explicit spacing between cells.
Sourcepub fn with_border_fill_id(self, border_fill_id: u32) -> Self
pub fn with_border_fill_id(self, border_fill_id: u32) -> Self
Sets the table-level border/fill reference.
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 UnsafeUnpin 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