What problem does it solve?
This Skill enforces type-safe bounds handling by replacing ambiguous raw indices with explicit Index/Length wrappers, reducing off-by-one errors and cross-type comparisons in Rust UI code.
Core Features & Use Cases
- Type-safe index and length wrappers (idx(), len()) to prevent mixed-type comparisons and off-by-one errors.
- Dedicated bounds-check traits: ArrayBoundsCheck, CursorBoundsCheck, ViewportBoundsCheck, RangeBoundsExt, and RangeConvertExt.
- Use cases across text editors, rendering pipelines, and range processing where indices and boundaries matter, including cursor positioning and viewport visibility checks.
- Encourages using TermRowDelta/TermColDelta for safe ANSI cursor movement.
Quick Start
Import the bound-checking primitives (idx, len, ArrayBoundsCheck, CursorBoundsCheck, ViewportBoundsCheck). Replace raw indices with Index/Length types and perform the appropriate checks before access or rendering. Example: let i = idx(10); let l = len(12); if i.overflows(l) { /* handle out of bounds */ } let pos = idx(5); l.check_cursor_position_bounds(pos) // validate cursor position; let visible = i.check_viewport_bounds(start, viewport_size) // determine visibility.