Skip to main content

encode_cell_record

Function encode_cell_record 

Source
pub fn encode_cell_record(cell: &Cell, extra: u16, link: u16) -> [u8; 18]
Expand description

Encode one Cell to its fixed 18-byte little-endian record: c u32 (Unicode scalar) · fg u32 · bg u32 · flags u16 · extra u16 (frame-local grapheme index, 0 = none) · link u16 (frame-local hyperlink index, 0 = none). Width derives from flags.

extra and link are passed in rather than read from the cell: combining clusters (#45) and hyperlinks (#46) now live in per-row maps, so both indices ride on the Span, not the cell. The wire bytes are unchanged.

This is the single definition of the cell record layout — encode writes it per span cell, and an alternate consumer (the WASM decoder, #34/ADR-0008) reuses it to lay decoded cells out flat without re-implementing the layout, so the two cannot drift.