pub struct LazyItems { /* private fields */ }Expand description
A run of lazy items: how many, and optionally how they are identified and reused.
A count converts into this on its own, so the ordinary list reads as
scope.items(20, |index| ...) — the shape Compose gets from default
arguments, which Rust does not have. A list whose contents move between
compositions names a key so item state follows the item rather than the
slot it happened to occupy:
scope.items(LazyItems::new(rows.len()).key(|index| rows[index].id), |index| {
Row(&rows[index]);
});Implementations§
Source§impl LazyItems
impl LazyItems
Sourcepub fn key(self, key: impl Fn(usize) -> u64 + 'static) -> LazyItems
pub fn key(self, key: impl Fn(usize) -> u64 + 'static) -> LazyItems
Gives each item a stable identity, so state, animations and scroll position follow the item when the list is reordered or edited.
Sourcepub fn content_type(
self,
content_type: impl Fn(usize) -> u64 + 'static,
) -> LazyItems
pub fn content_type( self, content_type: impl Fn(usize) -> u64 + 'static, ) -> LazyItems
Groups items into reuse classes, so a scrolling list recycles a row into another row of the same shape rather than rebuilding it.
Sourcepub fn span(
self,
span: impl Fn(LazyGridItemSpanScope, usize) -> usize + 'static,
) -> LazyItems
pub fn span( self, span: impl Fn(LazyGridItemSpanScope, usize) -> usize + 'static, ) -> LazyItems
Gives each item the number of cells it takes in a grid’s line —
Compose’s span. A list ignores it, and a grid clamps it to a line.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LazyItems
impl !Send for LazyItems
impl !Sync for LazyItems
impl !UnwindSafe for LazyItems
impl Freeze for LazyItems
impl Unpin for LazyItems
impl UnsafeUnpin for LazyItems
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> ErasedDestructor for Twhere
T: 'static,
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