pub fn debug_assert_well_formed(runs: &[FormatRun], block_text_len: usize)Expand description
Debug-only invariant check. Run from debug_assert! callsites in
the use cases that mutate format runs. Cheap: O(n) where n is the
run count (typically < 100 per block in real prose).
§Invariants
- Runs are sorted by
byte_startascending. - Each run has
byte_start < byte_end. - Runs are non-overlapping:
runs[i].byte_end <= runs[i+1].byte_start. - The last run’s
byte_enddoes not exceedblock_text_len. - Adjacent runs with identical format are coalesced (no two
consecutive runs satisfy
byte_end == next.byte_start && format == next.format).