pub trait LazyListScope {
// Required methods
fn item_keyed<F>(
&mut self,
key: Option<u64>,
content_type: Option<u64>,
content: F,
)
where F: Fn() + 'static;
fn items<I, F>(&mut self, items: I, item_content: F)
where I: Into<LazyItems>,
F: Fn(usize) + 'static;
// Provided method
fn item<F>(&mut self, content: F)
where F: Fn() + 'static { ... }
}Expand description
Receiver scope for lazy list content definition.
Used by LazyColumn and LazyRow to define list items.
Matches Jetpack Compose’s LazyListScope.
§Example
ⓘ
lazy_column(modifier, state, |scope| {
// Single item
scope.item_keyed(Some(0), None, || {
Text::new("Header")
});
// Multiple items
scope.items(data.len(), Some(|i| data[i].id), None, |i| {
Text::new(data[i].name.clone())
});
});Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".