Skip to main content

cranpose_ui/widgets/
foreach.rs

1//! ForEach iteration helper
2
3#![allow(non_snake_case)]
4
5use crate::composable;
6use std::hash::Hash;
7
8#[composable(no_skip)]
9pub fn ForEach<T, F>(items: &[T], mut row: F)
10where
11    T: Hash,
12    F: FnMut(&T) + 'static,
13{
14    for item in items {
15        cranpose_core::with_key(item, || row(item));
16    }
17}