Skip to main content

cranpose_ui/widgets/
foreach.rs

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