Skip to main content

Token

Trait Token 

Source
pub trait Token: Debug {
Show 13 methods // Required methods fn token_id(&self) -> TokenId; fn token_type(&self) -> i32; fn channel(&self) -> i32; fn start(&self) -> usize; fn stop(&self) -> usize; fn line(&self) -> usize; fn column(&self) -> usize; fn text(&self) -> Option<&str>; fn source_name(&self) -> &str; fn start_byte(&self) -> usize; fn stop_byte(&self) -> usize; // Provided methods fn interval(&self) -> TextInterval { ... } fn byte_span(&self) -> Range<usize> { ... }
}

Required Methods§

Source

fn token_id(&self) -> TokenId

Source

fn token_type(&self) -> i32

Source

fn channel(&self) -> i32

Source

fn start(&self) -> usize

Zero-based absolute start index measured in Unicode scalar values.

Source

fn stop(&self) -> usize

Zero-based absolute inclusive stop index measured in Unicode scalar values.

Source

fn line(&self) -> usize

One-based source line where the token starts.

Source

fn column(&self) -> usize

Zero-based source column where the token starts, measured in Unicode scalar values from the start of line.

Source

fn text(&self) -> Option<&str>

Source

fn source_name(&self) -> &str

Source

fn start_byte(&self) -> usize

Zero-based absolute start offset measured in UTF-8 bytes.

Source

fn stop_byte(&self) -> usize

Zero-based exclusive end offset measured in UTF-8 bytes.

Provided Methods§

Source

fn interval(&self) -> TextInterval

Source

fn byte_span(&self) -> Range<usize>

Zero-based UTF-8 byte span for the token text.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Token + ?Sized> Token for &T

Source§

fn token_id(&self) -> TokenId

Source§

fn token_type(&self) -> i32

Source§

fn channel(&self) -> i32

Source§

fn start(&self) -> usize

Source§

fn stop(&self) -> usize

Source§

fn line(&self) -> usize

Source§

fn column(&self) -> usize

Source§

fn text(&self) -> Option<&str>

Source§

fn source_name(&self) -> &str

Source§

fn start_byte(&self) -> usize

Source§

fn stop_byte(&self) -> usize

Implementors§