Trait chomp::combinators::bounded::BoundedRange [] [src]

pub trait BoundedRange {
    fn parse_many<I: Input, T, E, F, U>(
        self,
        _: I,
        _: F
    ) -> ParseResult<I, T, E>
    where
        F: FnMut(I) -> ParseResult<I, U, E>,
        T: FromIterator<U>
; fn skip_many<I: Input, T, E, F>(self, _: I, _: F) -> ParseResult<I, (), E>
    where
        F: FnMut(I) -> ParseResult<I, T, E>
; fn many_till<I: Input, T, E, R, F, U, N, V>(
        self,
        _: I,
        _: R,
        _: F
    ) -> ParseResult<I, T, E>
    where
        T: FromIterator<U>,
        E: From<N>,
        R: FnMut(I) -> ParseResult<I, U, E>,
        F: FnMut(I) -> ParseResult<I, V, N>
; }

Trait for applying a parser multiple times based on a range.

Required Methods

Applies the parser F multiple times until it fails or the maximum value of the range has been reached, collecting the successful values into a T: FromIterator.

Propagates errors if the minimum number of iterations has not been met

Panics

Will panic if the end of the range is smaller than the start of the range.

Notes

  • Will allocate depending on the FromIterator implementation.
  • Must never yield more items than the upper bound of the range.
  • Use combinators::bounded::many instead of calling this trait method directly.
  • If the last parser succeeds on the last input item then this parser is still considered incomplete if the input flag END_OF_INPUT is not set as there might be more data to fill.

Applies the parser F multiple times until it fails or the maximum value of the range has been reached, throwing away any produced value.

Propagates errors if the minimum number of iterations has not been met

Panics

Will panic if the end of the range is smaller than the start of the range.

Notes

  • Must never yield more items than the upper bound of the range.
  • Use combinators::bounded::many instead of calling this trait method directly.
  • If the last parser succeeds on the last input item then this parser is still considered incomplete if the input flag END_OF_INPUT is not set as there might be more data to fill.

Applies the parser P multiple times until the parser F succeeds and returns a value populated by the values yielded by P. Consumes the matched part of F. If F does not succeed within the given range R this combinator will propagate any failure from P.

Panics

Will panic if the end of the range is smaller than the start of the range.

Notes

  • Will allocate depending on the FromIterator implementation.
  • Use combinators::bounded::many_till instead of calling this trait method directly.
  • Must never yield more items than the upper bound of the range.
  • If the last parser succeeds on the last input item then this combinator is still considered incomplete unless the parser F matches or the lower bound has not been met.

Implementors