Expand description
A headless virtualization engine inspired by TanStack Virtual.
For adapter-level utilities (anchoring, tweens), see the virtualizer-adapter crate.
This crate focuses on the core algorithms needed to render massive lists at interactive frame rates: prefix sums over item sizes, fast offset → index lookup, overscanned visible ranges, and optional dynamic measurement.
It is UI-agnostic. A TUI/GUI layer is expected to provide:
- viewport size (height/width)
- scroll offset
- item size estimates and (optionally) dynamic measurements
§Feature flags
std(default): Enablesstdsupport.serde: Addsserde::Serialize/Deserializefor the public data types (ranges/items/state).tracing: Emits internal trace/debug/warn events viatracing(requiresstd).
Structs§
- Frame
State - A combined snapshot of viewport + scroll state.
- Index
Emitter - Helper to build correct
range_extractorimplementations without allocations. - Range
- The input range passed to a
crate::RangeExtractor. - Rect
- A platform-agnostic viewport rect.
- Scroll
State - A lightweight, serializable snapshot of the current scroll state.
- Viewport
State - A lightweight, serializable snapshot of the current viewport geometry.
- Virtual
Item - A virtual item produced for rendering.
- Virtual
Item Keyed - A virtual item that carries its stable key.
- Virtual
Range - A half-open range of virtual item indexes:
[start_index, end_index). - Virtualizer
- A headless virtualization engine.
- Virtualizer
Options - Configuration for
crate::Virtualizer.
Enums§
- Align
- Alignment used by scroll-to helpers.
- Initial
Offset - Initial scroll offset configuration.
- Scroll
Direction - Scroll direction derived from the latest scroll offset update.
Type Aliases§
- ItemKey
- Default item key type (index-based).
- OnChange
Callback - A callback fired when a virtualizer state update occurs.
- Range
Extractor - A callback that emits virtual item indexes for a given visible range.
- Should
Adjust Scroll Position OnItem Size Change Callback - A hook that decides whether to adjust scroll position when an item size changes.