Crate virtualizer

Crate virtualizer 

Source
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): Enables std support.
  • serde: Adds serde::Serialize/Deserialize for the public data types (ranges/items/state).
  • tracing: Emits internal trace/debug/warn events via tracing (requires std).

Structs§

FrameState
A combined snapshot of viewport + scroll state.
IndexEmitter
Helper to build correct range_extractor implementations without allocations.
Range
The input range passed to a crate::RangeExtractor.
Rect
A platform-agnostic viewport rect.
ScrollState
A lightweight, serializable snapshot of the current scroll state.
ViewportState
A lightweight, serializable snapshot of the current viewport geometry.
VirtualItem
A virtual item produced for rendering.
VirtualItemKeyed
A virtual item that carries its stable key.
VirtualRange
A half-open range of virtual item indexes: [start_index, end_index).
Virtualizer
A headless virtualization engine.
VirtualizerOptions
Configuration for crate::Virtualizer.

Enums§

Align
Alignment used by scroll-to helpers.
InitialOffset
Initial scroll offset configuration.
ScrollDirection
Scroll direction derived from the latest scroll offset update.

Type Aliases§

ItemKey
Default item key type (index-based).
OnChangeCallback
A callback fired when a virtualizer state update occurs.
RangeExtractor
A callback that emits virtual item indexes for a given visible range.
ShouldAdjustScrollPositionOnItemSizeChangeCallback
A hook that decides whether to adjust scroll position when an item size changes.