pub struct Token { /* private fields */ }Expand description
Token describes the primitive that is returned while iterating through a Tokenizer.
Tokens can be of different type or kind:
The associated data is stored in the Token, along with its start position (in bytes).
Implementations§
Source§impl Token
impl Token
Sourcepub fn character(character: char) -> Token
pub fn character(character: char) -> Token
Creates a character token with a given start position (in bytes).
Sourcepub fn is_character(&self) -> bool
pub fn is_character(&self) -> bool
Returns true if the Token is TokenKind::Character
Sourcepub fn is_character_equal(&self, input: char) -> bool
pub fn is_character_equal(&self, input: char) -> bool
Returns true if the Token is TokenKind::Character and equal to the input character.
Sourcepub fn is_word(&self) -> bool
pub fn is_word(&self) -> bool
Returns true if the Token is TokenKind::Word
Trait Implementations§
impl Copy for Token
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
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