Struct parsing_utils::PairsHelper
source · 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
sourceimpl<'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>ⓘNotable traits for PairPartialIter<'i, 'j, Rule>impl<'i, 'j, Rule: RuleType> Iterator for PairPartialIter<'i, 'j, Rule> type Item = Pair<'i, Rule>;
pub fn iter_while<'j>(&'j mut self, rule: Rule) -> PairPartialIter<'i, 'j, Rule>ⓘNotable traits for PairPartialIter<'i, 'j, Rule>impl<'i, 'j, Rule: RuleType> Iterator for PairPartialIter<'i, 'j, Rule> type Item = Pair<'i, Rule>;
Create an iterator of the first consecutive Pair’s that match a given Rule.
Trait Implementations
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more