pub struct Token { /* private fields */ }
Expand description
Holds a token’s class and its value.
Implementations§
Source§impl Token
impl Token
Sourcepub fn new(class: TokenClass, value: String) -> Self
pub fn new(class: TokenClass, value: String) -> Self
Constructs a new Token
from a value and a TokenClass
.
Sourcepub fn get_class(&self) -> TokenClass
pub fn get_class(&self) -> TokenClass
Gets the class of the token.
Sourcepub fn check(&self, class: TokenClass) -> bool
pub fn check(&self, class: TokenClass) -> bool
Checks if the token is in the given class.
Trait Implementations§
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