p
Size: a a a
p
G
p
В
#![feature(iter_map_while)]
use std::convert::TryFrom;
let a = [0, 1, 2, -3, 4, 5, -6];
let iter = a.iter().map_while(|x| u32::try_from(*x).ok());
let vec = iter.collect::<Vec<_>>();
// We have more elements those fit in u32 (4, 5), but `map_while`
// has stopped on the first `None` from predicate (when working with `-3`)
assert_eq!(vec, vec![0, 1, 8]);
G
G
G
G
G
P
DV
G
G
KB
P
P
KB
KB
P
P