pub struct TableCell {
pub paragraphs: Vec<Paragraph>,
pub col_span: u16,
pub row_span: u16,
pub width: HwpUnit,
pub background: Option<Color>,
}Expand description
A single cell within a table row.
Each cell contains its own paragraphs (rich content). Spans default to 1 (no spanning).
§Examples
use hwpforge_core::table::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(),
);
assert_eq!(cell.col_span, 1);
assert_eq!(cell.row_span, 1);Fields§
§paragraphs: Vec<Paragraph>Rich content within the cell.
col_span: u16Number of columns this cell spans. Must be >= 1.
row_span: u16Number of rows this cell spans. Must be >= 1.
width: HwpUnitCell width.
background: Option<Color>Optional cell background color.
Implementations§
Source§impl TableCell
impl TableCell
Sourcepub fn new(paragraphs: Vec<Paragraph>, width: HwpUnit) -> Self
pub fn new(paragraphs: Vec<Paragraph>, width: HwpUnit) -> Self
Creates a cell with default spans (1x1) and no background.
§Examples
use hwpforge_core::table::TableCell;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let cell = TableCell::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(50.0).unwrap(),
);
assert_eq!(cell.col_span, 1);
assert_eq!(cell.row_span, 1);
assert!(cell.background.is_none());Sourcepub fn with_span(
paragraphs: Vec<Paragraph>,
width: HwpUnit,
col_span: u16,
row_span: u16,
) -> Self
pub fn with_span( paragraphs: Vec<Paragraph>, width: HwpUnit, col_span: u16, row_span: u16, ) -> Self
Creates a cell with explicit span values.
§Examples
use hwpforge_core::table::TableCell;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let merged = TableCell::with_span(
vec![Paragraph::new(ParaShapeIndex::new(0))],
HwpUnit::from_mm(100.0).unwrap(),
2, // col_span
3, // row_span
);
assert_eq!(merged.col_span, 2);
assert_eq!(merged.row_span, 3);Trait Implementations§
Source§impl<'de> Deserialize<'de> for TableCell
impl<'de> Deserialize<'de> for TableCell
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 TableCell
impl JsonSchema for TableCell
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 TableCell
Auto Trait Implementations§
impl Freeze for TableCell
impl RefUnwindSafe for TableCell
impl Send for TableCell
impl Sync for TableCell
impl Unpin for TableCell
impl UnwindSafe for TableCell
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