pub trait RepetitionArgument: Clone {
    // Required methods
    fn at_least(&self) -> usize;
    fn at_most(&self) -> Option<usize>;
}
Expand description

Trait used to specify how many times a parser should run.

The following types implement this trait:

  • usize (e.g. 8): Run the parser 8 times.
  • RangeFrom (e.g. 4..) Run the parser at least 4 times (maybe more).
  • RangeInclusive (e.g. 3..=7) Run the parser at least 3 times, but no more than 7 times.
  • RangeToInclusive (e.g. ..=4) Run the parser at most 4 times (maybe less, even 0).

Required Methods§

source

fn at_least(&self) -> usize

The minimum amount of times the thing should be repeated

source

fn at_most(&self) -> Option<usize>

The maximum aount of times the thing should be repeated. If it is unbounded, this will return None

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl RepetitionArgument for usize

source§

impl RepetitionArgument for RangeFrom<usize>

source§

impl RepetitionArgument for RangeInclusive<usize>

source§

impl RepetitionArgument for RangeToInclusive<usize>

Implementors§