iter2/
iter2.rs

1use mut_str::StrExt;
2
3fn main() {
4    let mut s = Box::<str>::from("Hello, World!");
5    print!("{s:?}");
6
7    // Capitalise all the 'l's.
8    s.mut_iter()
9        .filter(|c| c == &'l')
10        .for_each(|c| c.replace('L').unwrap());
11
12    println!(" -> {s:?}");
13}
14
15// Test the example (this can be ignored)
16#[test]
17fn test() {
18    main();
19}