Struct relex::Token [−][src]
pub struct Token<'a, K: TokenKind> { pub kind: K, pub start: usize, pub end: usize, pub text: &'a str, pub skip: bool, pub next: Option<Box<Token<'a, K>>>, pub skipped: Vec<Token<'a, K>>, pub captures: Option<Vec<Option<(usize, usize)>>>, }
Expand description
Represents a detected token
Fields
kind: K
start: usize
end: usize
text: &'a str
skip: bool
next: Option<Box<Token<'a, K>>>
In some cases (viz. when an “unrecognized” token is returned), whatever token comes next is cached here.
skipped: Vec<Token<'a, K>>
The tokens skipped over to get here.
captures: Option<Vec<Option<(usize, usize)>>>
Implementations
impl<'a, K: TokenKind> Token<'a, K>
[src]
impl<'a, K: TokenKind> Token<'a, K>
[src]pub fn new(source: &'a str, kind: K, start: usize, end: usize) -> Token<'a, K>
[src]
pub fn from_text(kind: K, text: &'a str, start: usize) -> Token<'a, K>
[src]
pub fn eof(source: &'a str) -> Token<'a, K>
[src]
pub fn skip(self, skip: bool) -> Self
[src]
pub fn skipped(self, skipped: Vec<Token<'a, K>>) -> Self
[src]
pub fn next(self, next: Option<Box<Token<'a, K>>>) -> Self
[src]
pub fn captures(self, captures: Option<Vec<Option<(usize, usize)>>>) -> Self
[src]
pub fn get_capture(&self, idx: usize) -> Option<TokenCapture<'a>>
[src]
Trait Implementations
impl<'a, K: TokenKind> StructuralPartialEq for Token<'a, K>
[src]
Auto Trait Implementations
impl<'a, K> RefUnwindSafe for Token<'a, K> where
K: RefUnwindSafe,
K: RefUnwindSafe,
impl<'a, K> Send for Token<'a, K> where
K: Send,
K: Send,
impl<'a, K> Sync for Token<'a, K> where
K: Sync,
K: Sync,
impl<'a, K> Unpin for Token<'a, K> where
K: Unpin,
K: Unpin,
impl<'a, K> UnwindSafe for Token<'a, K> where
K: UnwindSafe,
K: UnwindSafe,