Highlight

Trait Highlight 

Source
pub trait Highlight: Sized + for<'a> Logos<'a, Source = str> {
    const LANG: &'static str;
    const START: Self;

    // Required method
    fn kind(tokens: &[Self; 2]) -> Kind;
}
Expand description

A type of token that can be highlighted.

Required Associated Constants§

Source

const LANG: &'static str

Name of the language of this highlighter.

Source

const START: Self

The token denoting the start, before input.

Required Methods§

Source

fn kind(tokens: &[Self; 2]) -> Kind

Determine the kind of a token from the current and the previous token.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Highlight for JavaScript

Source§

const LANG: &'static str = "js"

Source§

const START: Self = Self::None

Source§

impl Highlight for Rust

Source§

const LANG: &'static str = "rust"

Source§

const START: Self = Self::None

Source§

impl Highlight for Sh

Source§

const LANG: &'static str = "sh"

Source§

const START: Sh = Self::Start

Source§

impl Highlight for Toml

Source§

const LANG: &'static str = "toml"

Source§

const START: Self = Self::None