pub struct VirtualList {
pub estimate: f64,
pub gap: f64,
/* private fields */
}Expand description
A virtualized list: only the rows in (or near) the viewport are built and laid out;
spacers stand for the rest. Row heights start at an estimate and are learned from
laid-out rows (VirtualList::measure), so long chats stay cheap.
Fields§
§estimate: f64Height of a row not measured yet.
gap: f64Gap between rows.
Implementations§
Source§impl VirtualList
impl VirtualList
pub fn new(len: usize, estimate: f64) -> VirtualList
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn set_len(&mut self, n: usize)
pub fn set_len(&mut self, n: usize)
Grow or shrink to n rows (new rows unmeasured; kept rows keep their height).
Sourcepub fn invalidate(&mut self, i: usize)
pub fn invalidate(&mut self, i: usize)
Forget a row’s height (its content changed).
Sourcepub fn set_height(&mut self, i: usize, h: f64)
pub fn set_height(&mut self, i: usize, h: f64)
Set row i’s height (a host that lays rows out itself, e.g. from a cache of
laid trees, reports them here instead of VirtualList::measure).
Sourcepub fn height(&self, i: usize) -> Option<f64>
pub fn height(&self, i: usize) -> Option<f64>
Row i’s measured height (None: not measured, the estimate stands in).
Sourcepub fn tops(&self) -> Vec<f64>
pub fn tops(&self) -> Vec<f64>
Every row’s top in list coordinates in one pass (len() + 1 entries; the last
is the total without a trailing gap counted twice).
Sourcepub fn window(&self, scroll: f64, view: f64, overscan: f64) -> Window
pub fn window(&self, scroll: f64, view: f64, overscan: f64) -> Window
The rows covering scroll .. scroll + view, plus overscan pixels each way.
Trait Implementations§
Source§impl Clone for VirtualList
impl Clone for VirtualList
Source§fn clone(&self) -> VirtualList
fn clone(&self) -> VirtualList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more