for_each
function · ferroui-view · v0.5.0
fn for_each<T, I, K, E>(each: impl Fn() -> I + 'static, key: impl Fn(&T) -> K + 'static, view: impl Fn(T) -> E + 'static) -> crate::element::Element
where I: IntoIterator<Item = T>,
T: Clone + PartialEq + 'static,
K: Into<crate::element::Key>,
E: IntoElement
A list of children made from items, one per item, kept by key: an item
whose key and value stay keeps its control; an item that is new or whose
value changed gets a new one; the controls of items that left are taken
out. each is reactive: the list follows the signals it reads.
for_each(move || todos.get(), |todo| todo.id, move |todo| text_block().text(todo.title))
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.