Skip to main content

encode_cell_record

Function encode_cell_record 

Source
pub fn encode_cell_record(cell: &Cell) -> [u8; 14]
Expand description

Encode one Cell to its fixed 14-byte little-endian record: c u32 (Unicode scalar) · fg u32 · bg u32 · flags u16. Width derives from flags.

The record carries no grapheme or hyperlink reference (v14, #621). Both were u16 fields on every cell, and widening them to hold what the engine can legitimately store would have inflated a record every cell pays — the trade ADR-0008’s Axis 4 already rejected in the other direction. They moved to sparse per-Span groups instead, which is why this record shrank by 4 bytes: measured, −20.9% on an ordinary frame that carries neither.

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.