Function nommy::parse_terminated [−][src]
pub fn parse_terminated<P, I>(iter: I) -> Result<P> where
P: Parse<<I::Iter as Iterator>::Item>,
I: IntoBuf,
<I::Iter as Iterator>::Item: Clone,
parse_terminated
takes the given iterator, putting it through P::parse
,
erroring if the full input was not consumed
use nommy::{parse_terminated, text::Tag}; let res: Result<Tag<".">, _> = parse_terminated(".".chars()); res.unwrap(); let res: Result<Tag<".">, _> = parse_terminated("..".chars()); res.unwrap_err();
Errors
If P
failed to parse the input at any point, that error will
be propagated up the chain.
Will also error if the input is not empty after parsing