#[non_exhaustive]pub struct VirtualItems {
pub count: usize,
pub mode: VirtualMode,
pub anchor_policy: VirtualAnchorPolicy,
pub row_key: Arc<dyn Fn(usize) -> String + Send + Sync>,
pub build_row: Arc<dyn Fn(usize) -> El + Send + Sync>,
}Expand description
Virtualized list state attached to a Kind::VirtualList node:
row count, row-height policy, and the closures that identify and
realize rows. Built via Self::new / Self::new_dyn or,
more commonly, the crate::virtual_list /
crate::virtual_list_dyn builders. See VirtualMode for the
scope and policy discussion.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.count: usizeTotal number of rows in the list (realized or not).
mode: VirtualModeRow-height policy — see VirtualMode.
anchor_policy: VirtualAnchorPolicyHow the next frame’s scroll anchor is chosen after each layout pass (dynamic mode only).
row_key: Arc<dyn Fn(usize) -> String + Send + Sync>Stable identity for a row by global index. Keys measured heights
and ScrollRequest::ToRowKey targets across reorders /
insertions; defaults to the index itself in fixed mode.
build_row: Arc<dyn Fn(usize) -> El + Send + Sync>Realize the row at a global index. Called only for rows whose rect intersects the viewport.
Implementations§
Source§impl VirtualItems
impl VirtualItems
Sourcepub fn new<F>(count: usize, row_height: f32, build_row: F) -> Self
pub fn new<F>(count: usize, row_height: f32, build_row: F) -> Self
Fixed-height list: every row is row_height logical pixels.
Row keys default to the stringified index. Panics if
row_height <= 0.0. Prefer the crate::virtual_list builder.
Sourcepub fn new_dyn<K, F>(
count: usize,
estimated_row_height: f32,
row_key: K,
build_row: F,
) -> Self
pub fn new_dyn<K, F>( count: usize, estimated_row_height: f32, row_key: K, build_row: F, ) -> Self
Variable-height list: rows start at estimated_row_height
logical pixels and are replaced by real measurements as they
become visible. row_key must give each row a stable identity.
Panics if estimated_row_height <= 0.0. Prefer the
crate::virtual_list_dyn builder.
Sourcepub fn append_only(self) -> Self
pub fn append_only(self) -> Self
Declare the append-only contract on a dynamic list — see
VirtualMode::Dynamic::append_only. No-op (and harmless) on a
fixed list, whose range math is already O(1).
Sourcepub fn anchor_policy(self, policy: VirtualAnchorPolicy) -> Self
pub fn anchor_policy(self, policy: VirtualAnchorPolicy) -> Self
Replace the default anchor policy
(VirtualAnchorPolicy::ViewportFraction at 0.25).
Trait Implementations§
Source§impl Clone for VirtualItems
impl Clone for VirtualItems
Source§fn clone(&self) -> VirtualItems
fn clone(&self) -> VirtualItems
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 !RefUnwindSafe for VirtualItems
impl !UnwindSafe for VirtualItems
impl Freeze for VirtualItems
impl Send for VirtualItems
impl Sync for VirtualItems
impl Unpin for VirtualItems
impl UnsafeUnpin for VirtualItems
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.