Struct SparseVirtualViewport
pub struct SparseVirtualViewport<K> { /* private fields */ }Expand description
Virtual geometry for collections whose logical item count is much larger than the set of resident keys.
Unlike VirtualViewport, this type does not store one entry per logical
row. Unmeasured rows share an estimate; only measured stable keys and their
prefix-sum deltas consume memory. The owning model resolves keys at visible
indices and indices for measured/anchored keys during reconciliation.
Implementations§
§impl<K> SparseVirtualViewport<K>
impl<K> SparseVirtualViewport<K>
pub fn new(estimated_height: f64) -> SparseVirtualViewport<K>
pub fn set_edges(&mut self, lead: f64, trail: f64) -> bool
pub fn set_edges(&mut self, lead: f64, trail: f64) -> bool
Leave lead above the first item and trail below the last, as a
page’s padding is: the content’s, scrolled with the items, and hitting
none. A view showing the lead (at its top) stays at its top; one
scrolled past it keeps the items in view where they are. Whether they
changed.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn resident_measurements(&self) -> usize
pub fn estimated_height(&self) -> f64
pub fn set_estimated_height(&mut self, height: f64)
pub fn set_minimum_height(&mut self, height: f64)
pub fn set_minimum_height(&mut self, height: f64)
Set a geometry floor without discarding authored estimates or stable measured heights. Lowering the floor restores those original values.
pub fn minimum_height(&self) -> f64
pub fn set_viewport(&mut self, height: f64)
pub fn viewport(&self) -> f64
pub fn set_overscan(&mut self, pixels: f64)
pub fn overscan(&self) -> f64
pub fn offset(&self) -> f64
pub fn set_offset(&mut self, offset: f64)
pub fn scroll_by(&mut self, delta: f64)
pub fn content_extent(&self) -> f64
pub fn max_offset(&self) -> f64
pub fn capture_anchor<F>(&self, key_at: F) -> Option<SparseAnchor<K>>
pub fn capture_anchor<F>(&self, key_at: F) -> Option<SparseAnchor<K>>
Capture the first visible stable key before a model mutation.
pub fn reconcile<F>(
&mut self,
count: usize,
index_of: F,
anchor: Option<&SparseAnchor<K>>,
)
pub fn reconcile<F>( &mut self, count: usize, index_of: F, anchor: Option<&SparseAnchor<K>>, )
Reconcile a new logical count. index_of is called only for resident
measured keys and the captured anchor, never for every logical row.
pub fn is_measured(&self, key: &K) -> bool
pub fn is_measured(&self, key: &K) -> bool
Whether key has a measured height: a row that has been laid out,
as against one that stands at the estimate.
pub fn measure(&mut self, index: usize, key: K, height: f64) -> bool
pub fn measure(&mut self, index: usize, key: K, height: f64) -> bool
Store a measured height for the stable key currently at index.
pub fn collapse(&mut self, index: usize, key: K) -> bool
pub fn collapse(&mut self, index: usize, key: K) -> bool
Cache a row folded away as taking no room at all: a closed group’s rows stand on the same offset, under their heading’s band.
pub fn expand(&mut self, index: usize, key: &K) -> bool
pub fn expand(&mut self, index: usize, key: &K) -> bool
Forget a row’s folded-away measurement: it takes the room it measures again, as a row
that was never folded does. Self::collapse’s other half.
pub fn remap_key(&mut self, old: &K, new: K) -> bool
pub fn remap_key(&mut self, old: &K, new: K) -> bool
Move a resident measurement to a replacement stable key without changing its logical position. Useful when a placeholder resolves to a real model id.
pub fn item_height(&self, index: usize) -> Option<f64>
pub fn item_top(&self, index: usize) -> Option<f64>
pub fn item_view_top(&self, index: usize) -> Option<f64>
pub fn visible_range(&self) -> Range<usize> ⓘ
pub fn range_around(&self, above: f64, below: f64) -> Range<usize> ⓘ
pub fn range_around(&self, above: f64, below: f64) -> Range<usize> ⓘ
Half-open item range intersecting the viewport stretched above
pixels up and below pixels down.
pub fn hit_test(&self, viewport_y: f64) -> Option<usize>
pub fn scroll_to_index( &mut self, index: usize, alignment: ScrollAlignment, ) -> bool
Trait Implementations§
§impl<K> Clone for SparseVirtualViewport<K>where
K: Clone,
impl<K> Clone for SparseVirtualViewport<K>where
K: Clone,
§fn clone(&self) -> SparseVirtualViewport<K>
fn clone(&self) -> SparseVirtualViewport<K>
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<K> Freeze for SparseVirtualViewport<K>
impl<K> RefUnwindSafe for SparseVirtualViewport<K>where
K: RefUnwindSafe,
impl<K> Send for SparseVirtualViewport<K>where
K: Send,
impl<K> Sync for SparseVirtualViewport<K>where
K: Sync,
impl<K> Unpin for SparseVirtualViewport<K>where
K: Unpin,
impl<K> UnsafeUnpin for SparseVirtualViewport<K>
impl<K> UnwindSafe for SparseVirtualViewport<K>where
K: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more