pub enum VirtualMode {
Fixed {
row_height: f32,
},
Dynamic {
estimated_row_height: f32,
append_only: bool,
},
}Expand description
Virtualized list state attached to a Kind::VirtualList node.
Holds the row count, the row-height policy, and the closure that
realizes a row by global index. Set via crate::virtual_list or
crate::virtual_list_dyn; the layout pass calls build_row(i)
only for indices whose rect intersects the viewport.
§Row-height policies
VirtualMode::Fixed— every row is the same logical-pixel height. Scroll → visible-range is O(1).VirtualMode::Dynamic— rows vary in height. The library usesestimated_row_heightas a placeholder for unmeasured rows, measures visible rows at the current layout width, and preserves a row anchor on screen while estimates become measurements.
§Other current scope
- Vertical only — feed/chat-log-shaped lists are the target. A horizontal variant can come later.
- No row pooling — visible rows are rebuilt from scratch each layout pass. Fine for thousands of items; if it bottlenecks we add a pool keyed by stable row keys.
Variants§
Fixed
Every row is exactly row_height logical pixels tall.
Dynamic
Rows have variable heights. estimated_row_height seeds the
content-height total and the visible-range walk for rows that
haven’t been measured yet.
Fields
estimated_row_height: f32Placeholder height (logical pixels) for not-yet-measured rows. Must be > 0.
append_only: boolOpt-in contract: across frames the row sequence changes
only by appending rows at the tail and/or dropping a
contiguous prefix at the head (an append-at-bottom feed or a
capped ring buffer). When set, layout maintains an
incremental per-row height index so the per-frame cost is
O(visible) instead of several O(n) walks — the difference
that lets a 100k-row chat log stay inside frame budget while
scrolling (issue #107). Reordering, mid-list insertion, or
re-keying a surviving row violates the contract: debug builds
assert, release self-heals with a one-frame O(n) rebuild.
Set via VirtualItems::append_only /
crate::tree::El::append_only.
Trait Implementations§
Source§impl Clone for VirtualMode
impl Clone for VirtualMode
Source§fn clone(&self) -> VirtualMode
fn clone(&self) -> VirtualMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for VirtualMode
impl RefUnwindSafe for VirtualMode
impl Send for VirtualMode
impl Sync for VirtualMode
impl Unpin for VirtualMode
impl UnsafeUnpin for VirtualMode
impl UnwindSafe for VirtualMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.