position

Function position 

Source
pub fn position<T, E>(s: T) -> IResult<T, T, E>
where E: ParseError<T>, T: Input,
Expand description

Capture the position of the current fragment

Examples found in repository?
examples/position.rs (line 18)
16fn parse_foobar(s: Span) -> IResult<Span, Token> {
17    let (s, _) = take_until("foo")(s)?;
18    let (s, pos) = position(s)?;
19    let (s, foo) = tag("foo")(s)?;
20    let (s, bar) = tag("bar")(s)?;
21
22    Ok((
23        s,
24        Token {
25            position: pos,
26            _foo: foo.fragment(),
27            _bar: bar.fragment(),
28        },
29    ))
30}