Struct Pairs
struct Pairs<'i, R> { ... }
An iterator over Pairs. It is created by pest::state and Pair::into_inner.
Implementations
impl<'i, R: RuleType> Pairs<'i, R>
fn as_str(self: &Self) -> &'i strCaptures a slice from the
&strdefined by the starting position of the first tokenPairand the ending position of the last tokenPairof thePairs. This also captures the input between those two tokenPairs.Examples
# use Rc; # use pest; # # let input = "a b"; let pairs = state.unwrap; assert_eq!;fn get_input(self: &Self) -> &'i strReturns the input string of
Pairs.This function returns the input string of
Pairsas a&str. This is the source string from whichPairswas created. The returned&strcan be used to examine the contents ofPairsor to perform further processing on the string.Examples
# use Rc; # use pest; # # // Example: Get input string from Pairs let input = "a b"; let pairs = state.unwrap; assert_eq!; assert_eq!;fn concat(self: &Self) -> StringCaptures inner token
Pairs and concatenates resulting&strs. This does not capture the input between tokenPairs.Examples
# use Rc; # use pest; # # let input = "a b"; let pairs = state.unwrap; assert_eq!;fn flatten(self: Self) -> FlatPairs<'i, R>Flattens the
Pairs.Examples
# use Rc; # use pest; # # let input = ""; let pairs = state.unwrap; let tokens: = pairs.flatten.tokens.collect; assert_eq!;fn find_first_tagged(self: &Self, tag: &'i str) -> Option<Pair<'i, R>>Finds the first pair that has its node or branch tagged with the provided label. Searches in the flattened
Pairsiterator.Examples
Try to recognize the branch between add and mul
use ; let input = "1+2"; let pairs = state.unwrap; assert_eq!; assert_eq!;fn find_tagged(self: Self, tag: &'i str) -> Filter<FlatPairs<'i, R>, impl FnMut(&Pair<'i, R>) -> bool + 'i>Returns the iterator over pairs that have their node or branch tagged with the provided label. The iterator is built from a flattened
Pairsiterator.Examples
Try to recognize the node between left and right hand side
use ; let input = "1+2"; let pairs = state.unwrap; let mut left_numbers = pairs.find_tagged; assert_eq!; assert_eq!;fn tokens(self: Self) -> Tokens<'i, R>Returns the
Tokensfor thePairs.Examples
# use Rc; # use pest; # # let input = ""; let pairs = state.unwrap; let tokens: = pairs.tokens.collect; assert_eq!;fn peek(self: &Self) -> Option<Pair<'i, R>>Peek at the first inner
Pairwithout changing the position of this iterator.
impl<'i, R: RuleType> Pairs<'i, R>
fn single(pair: Pair<'i, R>) -> SelfCreate a new
Pairsiterator containing just the singlePair.
impl<'i, R> Freeze for Pairs<'i, R>
impl<'i, R> RefUnwindSafe for Pairs<'i, R>
impl<'i, R> Send for Pairs<'i, R>
impl<'i, R> Sync for Pairs<'i, R>
impl<'i, R> Unpin for Pairs<'i, R>
impl<'i, R> UnsafeUnpin for Pairs<'i, R>
impl<'i, R> UnwindSafe for Pairs<'i, R>
impl<'i, R: $crate::clone::Clone> Clone for Pairs<'i, R>
fn clone(self: &Self) -> Pairs<'i, R>
impl<'i, R: Eq> Eq for Pairs<'i, R>
impl<'i, R: Hash> Hash for Pairs<'i, R>
fn hash<H: Hasher>(self: &Self, state: &mut H)
impl<'i, R: PartialEq> PartialEq for Pairs<'i, R>
fn eq(self: &Self, other: &Pairs<'i, R>) -> bool
impl<'i, R: RuleType> Debug for Pairs<'i, R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'i, R: RuleType> Display for Pairs<'i, R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'i, R: RuleType> DoubleEndedIterator for Pairs<'i, R>
fn next_back(self: &mut Self) -> Option<<Self as >::Item>
impl<'i, R: RuleType> ExactSizeIterator for Pairs<'i, R>
fn len(self: &Self) -> usize
impl<'i, R: RuleType> Iterator for Pairs<'i, R>
fn next(self: &mut Self) -> Option<<Self as >::Item>fn size_hint(self: &Self) -> (usize, Option<usize>)
impl<I> IntoIterator for Pairs<'i, R>
fn into_iter(self: Self) -> I
impl<T> Any for Pairs<'i, R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Pairs<'i, R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Pairs<'i, R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Pairs<'i, R>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Pairs<'i, R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Pairs<'i, R>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Pairs<'i, R>
fn to_string(self: &Self) -> String
impl<T, U> Into for Pairs<'i, R>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Pairs<'i, R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Pairs<'i, R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>