Skip to main content

each

Function each 

Source
pub fn each<I, V>(
    items: I,
    f: impl FnMut(<I as IntoIterator>::Item) -> V,
) -> Node
where I: IntoIterator, V: View,
Expand description

Render every item of an iterator.

use next_rust_view::*;
let list = ul![each(["a", "b"], |x| li![key(x), x])];
assert_eq!(render_static(list), r#"<ul><li data-nr-key="a">a</li><li data-nr-key="b">b</li></ul>"#);