pub enum VirtualMode {
Fixed {
row_height: f32,
},
Dynamic {
estimated_row_height: f32,
},
}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.
Trait Implementations§
Source§impl Clone for VirtualMode
impl Clone for VirtualMode
Source§fn clone(&self) -> VirtualMode
fn clone(&self) -> VirtualMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.