Module run

Module run 

Source
Expand description

Run and RunContent: the leaf nodes of the document tree.

A Run is a contiguous segment of content with a single character shape (font, size, etc.). The actual content is held in RunContent, which may be text, a table, an image, or a control element.

§Enum Size Optimization

Table and Control are large types. They are boxed inside RunContent to keep the common case (RunContent::Text) small:

  • Text(String) – 24 bytes
  • Table(Box<Table>) – 8 bytes (pointer)
  • Image(Image) – moderate
  • Control(Box<Control>) – 8 bytes (pointer)

§Examples

use hwpforge_core::run::{Run, RunContent};
use hwpforge_foundation::CharShapeIndex;

let run = Run::text("Hello, world!", CharShapeIndex::new(0));
assert_eq!(run.content.as_text(), Some("Hello, world!"));
assert!(run.content.is_text());

Structs§

Run
A run: a segment of content with a single character shape reference.

Enums§

RunContent
The content of a run.