pub struct LazyItems { /* private fields */ }Expand description
Re-export the UI crate so applications can depend on a single crate. 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.
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
Mutably borrows from an owned value. Read more
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.