Trait LanguageSet

pub trait LanguageSet<'s>: Sized {
    type Language: SupportedLanguage<'s, Self>;

    // Required method
    fn get_language(
        &self,
        language: Self::Language,
    ) -> Result<&HighlightConfiguration, Error>;
}
Expand description

Describes a type that is able to provide tree-sitter parsers and queries.

All official syntastica parser collections provide a type called LanguageSetImpl which implements this trait. See the project overview for more information on that.

Required Associated Types§

type Language: SupportedLanguage<'s, Self>

A type identifying a language that is included in this set.

The given type should usually be an enum of all included languages.

Required Methods§

fn get_language( &self, language: Self::Language, ) -> Result<&HighlightConfiguration, Error>

Get the HighlightConfiguration for a given language.

The returned HighlightConfiguration must be configured with THEME_KEYS.

The function is given an instance of Self::Language and as such should not need to return an Error::UnsupportedLanguage error.

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§

§

impl<'s, L, R> LanguageSet<'s> for Union<L, R>
where L: LanguageSet<'s>, R: LanguageSet<'s>,