pub fn for_each<'a>(
value: &'a [u8],
limits: &Limits,
f: impl FnMut(&'a [u8]),
) -> Result<usize, ParseError>Expand description
Validates value and calls f for each element in the same pass, then
returns the element count.
On error, f has seen the elements before the failure.
§Errors
As parse.
§Examples
use parse_net::{list, Limits};
let mut longest = 0;
let n = list::for_each(b"gzip, br, zstd", &Limits::DEFAULT, |e| longest = longest.max(e.len()))?;
assert_eq!((n, longest), (3, 4));