pub struct Token<'a> {
pub token_type: TokenType,
pub span: &'a str,
pub line: usize,
pub column: usize,
}Expand description
Token produced by ASS tokenizer with zero-copy span
Represents a lexical unit in ASS script with location information. The span references the original source text to avoid allocations.
Fields§
§token_type: TokenTypeToken type discriminant
span: &'a strZero-copy span referencing source text
line: usizeLine number where token starts (1-based)
column: usizeColumn number where token starts (1-based)
Implementations§
Source§impl<'a> Token<'a>
impl<'a> Token<'a>
Sourcepub const fn new(
token_type: TokenType,
span: &'a str,
line: usize,
column: usize,
) -> Self
pub const fn new( token_type: TokenType, span: &'a str, line: usize, column: usize, ) -> Self
Create new token with full location information
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Check if token is empty (should not happen in normal tokenization)
Sourcepub fn end_column(&self) -> usize
pub fn end_column(&self) -> usize
Get end column position
Sourcepub const fn is_whitespace(&self) -> bool
pub const fn is_whitespace(&self) -> bool
Check if this token represents whitespace
Sourcepub const fn is_delimiter(&self) -> bool
pub const fn is_delimiter(&self) -> bool
Check if this token represents a delimiter
Sourcepub const fn is_content(&self) -> bool
pub const fn is_content(&self) -> bool
Check if this token represents content (text, numbers, etc.)
Sourcepub const fn validate_utf8(&self) -> bool
pub const fn validate_utf8(&self) -> bool
Validate that span references valid UTF-8
Trait Implementations§
impl<'a> Eq for Token<'a>
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnsafeUnpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
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