Function pom::parser::take

source ·
pub fn take<'a, I>(n: usize) -> Parser<'a, I, &'a [I]>
Expand description

Read n symbols.

Examples found in repository?
examples/simple.rs (line 7)
3
4
5
6
7
8
9
10
fn example<'a>() -> Parser<'a, u8, Vec<u8>> {
	(sym(b'<') * none_of(b">").repeat(0..) - sym(b'>'))
		>> |tag| {
			(call(example) | none_of(b"<>").repeat(0..))
				- seq(b"</") - take(tag.len()).convert(move |t| if t == tag { Ok(()) } else { Err(()) })
				- sym(b'>')
		}
}