pub struct Token<'input>(/* private fields */);Expand description
A scanner token.
Implementations§
Source§impl<'input> Token<'input>
impl<'input> Token<'input>
Sourcepub const fn new(span: Span, token_type: TokenType<'input>) -> Self
pub const fn new(span: Span, token_type: TokenType<'input>) -> Self
Create a scanner token from its source span and payload.
Sourcepub const fn token_type(&self) -> &TokenType<'input>
pub const fn token_type(&self) -> &TokenType<'input>
Return the payload emitted by the scanner.
Sourcepub fn into_parts(self) -> (Span, TokenType<'input>)
pub fn into_parts(self) -> (Span, TokenType<'input>)
Consume the token and return its source span and payload.
Trait Implementations§
impl<'input> Eq for Token<'input>
impl<'input> StructuralPartialEq for Token<'input>
Auto Trait Implementations§
impl<'input> Freeze for Token<'input>
impl<'input> RefUnwindSafe for Token<'input>
impl<'input> Send for Token<'input>
impl<'input> Sync for Token<'input>
impl<'input> Unpin for Token<'input>
impl<'input> UnsafeUnpin for Token<'input>
impl<'input> UnwindSafe for Token<'input>
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