Struct Pair
struct Pair<'i, R> { ... }
A matching pair of Tokens and everything between them.
A matching Token pair is formed by a Token::Start and a subsequent Token::End with the
same Rule, with the condition that all Tokens between them can form such pairs as well.
This is similar to the brace matching problem in
editors.
Implementations
impl<'i, R: RuleType> Pair<'i, R>
fn as_rule(self: &Self) -> RReturns the
Ruleof thePair.Examples
# use Rc; # use pest; # # let input = ""; let pair = state.unwrap.next.unwrap; assert_eq!;fn as_str(self: &Self) -> &'i strCaptures a slice from the
&strdefined by the tokenPair.Examples
# use Rc; # use pest; # # let input = "ab"; let pair = state.unwrap.next.unwrap; assert_eq!;fn get_input(self: &Self) -> &'i strReturns the input string of the
Pair.This function returns the input string of the
Pairas a&str. This is the source string from which thePairwas created. The returned&strcan be used to examine the contents of thePairor to perform further processing on the string.Examples
# use Rc; # use pest; # # // Example: Get input string from a Pair let input = "ab"; let pair = state.unwrap.next.unwrap; assert_eq!; assert_eq!;fn into_span(self: Self) -> Span<'i>Returns the
Spandefined by thePair, consuming it.Examples
# use Rc; # use pest; # # let input = "ab"; let pair = state.unwrap.next.unwrap; assert_eq!;fn as_span(self: &Self) -> Span<'i>Returns the
Spandefined by thePair, without consuming it.Examples
# use Rc; # use pest; # # let input = "ab"; let pair = state.unwrap.next.unwrap; assert_eq!;fn as_node_tag(self: &Self) -> Option<&str>Get current node tag
fn into_inner(self: Self) -> Pairs<'i, R>Returns the inner
Pairsbetween thePair, consuming it.Examples
# use Rc; # use pest; # # let input = ""; let pair = state.unwrap.next.unwrap; assert!;fn tokens(self: Self) -> Tokens<'i, R>Returns the
Tokensfor thePair.Examples
# use Rc; # use pest; # # let input = ""; let pair = state.unwrap.next.unwrap; let tokens: = pair.tokens.collect; assert_eq!;fn line_col(self: &Self) -> (usize, usize)Returns the
line,colof this pair start.
impl<'i, R> Freeze for Pair<'i, R>
impl<'i, R> RefUnwindSafe for Pair<'i, R>
impl<'i, R> Send for Pair<'i, R>
impl<'i, R> Sync for Pair<'i, R>
impl<'i, R> Unpin for Pair<'i, R>
impl<'i, R> UnsafeUnpin for Pair<'i, R>
impl<'i, R> UnwindSafe for Pair<'i, R>
impl<'i, R: $crate::clone::Clone> Clone for Pair<'i, R>
fn clone(self: &Self) -> Pair<'i, R>
impl<'i, R: Eq> Eq for Pair<'i, R>
impl<'i, R: Hash> Hash for Pair<'i, R>
fn hash<H: Hasher>(self: &Self, state: &mut H)
impl<'i, R: PartialEq> PartialEq for Pair<'i, R>
fn eq(self: &Self, other: &Pair<'i, R>) -> bool
impl<'i, R: RuleType> Debug for Pair<'i, R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'i, R: RuleType> Display for Pair<'i, R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Any for Pair<'i, R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Pair<'i, R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Pair<'i, R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Pair<'i, R>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Pair<'i, R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Pair<'i, R>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Pair<'i, R>
fn to_string(self: &Self) -> String
impl<T, U> Into for Pair<'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 Pair<'i, R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Pair<'i, R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>