pub struct PairsHelper<'i, Rule: RuleType>(pub Pairs<'i, Rule>);
Expand description
A useful wrapper around pest Pairs, that provide several convenient shortcuts to read the Pair’s inside it.
It is intended to be used in exhaustive parsing, and will assert that all Pair’s have been read out when this wrapper is dropped.
Tuple Fields§
§0: Pairs<'i, Rule>
Implementations§
Source§impl<'i, Rule: RuleType> PairsHelper<'i, Rule>
impl<'i, Rule: RuleType> PairsHelper<'i, Rule>
Sourcepub fn next_rule(&mut self, rule: Rule) -> Pair<'i, Rule>
pub fn next_rule(&mut self, rule: Rule) -> Pair<'i, Rule>
Get next Pair and assert its rule type. Panics if there is not one, or the rule type does not match.
Sourcepub fn next_rule_opt(&mut self, rule: Rule) -> Option<Pair<'i, Rule>>
pub fn next_rule_opt(&mut self, rule: Rule) -> Option<Pair<'i, Rule>>
Get the next Pair if it matches the given Rule. This will not panic.
Sourcepub fn iter_while<'j>(&'j mut self, rule: Rule) -> PairPartialIter<'i, 'j, Rule> ⓘ
pub fn iter_while<'j>(&'j mut self, rule: Rule) -> PairPartialIter<'i, 'j, Rule> ⓘ
Create an iterator of the first consecutive Pair’s that match a given Rule.
Trait Implementations§
Auto Trait Implementations§
impl<'i, Rule> Freeze for PairsHelper<'i, Rule>
impl<'i, Rule> RefUnwindSafe for PairsHelper<'i, Rule>where
Rule: RefUnwindSafe,
impl<'i, Rule> !Send for PairsHelper<'i, Rule>
impl<'i, Rule> !Sync for PairsHelper<'i, Rule>
impl<'i, Rule> Unpin for PairsHelper<'i, Rule>
impl<'i, Rule> UnwindSafe for PairsHelper<'i, Rule>where
Rule: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more