pub struct TokenSpec {
pub token_type: i32,
pub channel: i32,
pub start: usize,
pub stop: usize,
pub start_byte: usize,
pub stop_byte: usize,
pub line: usize,
pub column: usize,
pub text: Option<String>,
pub source_backed: bool,
}Expand description
The fields emitted for one token.
This is transient sink input, not an owned token representation. Source
text and the source name live once in TokenStore.
Fields§
§token_type: i32§channel: i32§start: usize§stop: usize§start_byte: usize§stop_byte: usize§line: usize§column: usize§text: Option<String>§source_backed: boolImplementations§
Source§impl TokenSpec
impl TokenSpec
pub fn explicit(token_type: i32, text: impl Into<String>) -> Self
pub fn eof(index: usize, byte_offset: usize, line: usize, column: usize) -> Self
pub const fn with_channel(self, channel: i32) -> Self
pub const fn with_span(self, start: usize, stop: usize) -> Self
pub const fn with_byte_span(self, start_byte: usize, stop_byte: usize) -> Self
pub const fn with_position(self, line: usize, column: usize) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TokenSpec
impl RefUnwindSafe for TokenSpec
impl Send for TokenSpec
impl Sync for TokenSpec
impl Unpin for TokenSpec
impl UnsafeUnpin for TokenSpec
impl UnwindSafe for TokenSpec
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