Skip to main content

SourceToken

Trait SourceToken 

Source
pub trait SourceToken: Copy {
    type Kind: Copy;

    const EMPTY: Self;

    // Required methods
    fn kind(self) -> Self::Kind;
    fn len(self) -> u32;
    fn kind_name(self) -> &'static str;

    // Provided methods
    fn leading_len(self) -> u32 { ... }
    fn trailing_len(self) -> u32 { ... }
    fn is_empty(self) -> bool { ... }
}
Expand description

A token that occupies bytes in source text.

Required Associated Constants§

Source

const EMPTY: Self

Token occupying no source bytes.

Required Associated Types§

Source

type Kind: Copy

Token category.

Required Methods§

Source

fn kind(self) -> Self::Kind

Returns token category.

Source

fn len(self) -> u32

Returns token length in bytes.

Source

fn kind_name(self) -> &'static str

Returns token category name.

Provided Methods§

Source

fn leading_len(self) -> u32

Returns bytes before token value.

Source

fn trailing_len(self) -> u32

Returns bytes after token value.

Source

fn is_empty(self) -> bool

Returns whether token occupies no bytes.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§