loops/
loops.rs

1#![feature(type_alias_impl_trait, impl_trait_in_assoc_type)]
2
3use nuit::{Bind, ForEach, HStack, Text, VStack, View};
4
5#[derive(Bind)]
6struct LoopsView;
7
8impl View for LoopsView {
9    type Body = impl View;
10
11    fn body(&self) -> Self::Body {
12        VStack::new((
13            HStack::new(
14                ForEach::new(["Hello", "World"], |s| {
15                    Text::new(s)
16                }),
17            ),
18            HStack::new(
19                ForEach::new(0..10, |i| {
20                    Text::new(format!("{i}"))
21                })
22            ),
23        ))
24    }
25}
26
27fn main() {
28    nuit::run_app(LoopsView);
29}