pub trait Container {
    // Required methods
    fn get_language_by_name(&self, name: &str) -> Option<&Language>;
    fn get_languages_by_extension(
        &self,
        file: impl AsRef<Path>
    ) -> Option<Vec<&Language>>;
    fn get_languages_by_filename(
        &self,
        file: impl AsRef<Path>
    ) -> Option<Vec<&Language>>;
    fn get_languages_by_interpreter(
        &self,
        interpreter: &str
    ) -> Option<Vec<&Language>>;
    fn get_heuristics_by_extension(
        &self,
        file: impl AsRef<Path>
    ) -> Option<&Vec<HeuristicRule>>;
}
Expand description

A Container can be used to implement a storage that holds Language and HeuristicRule definitions.

Features

When the matcher feature is enabled, the Container trait will also expose methods to retrieve HeuristicRule definitions.

Required Methods§

source

fn get_language_by_name(&self, name: &str) -> Option<&Language>

Returns a list of all Language definitions identified by its name.

source

fn get_languages_by_extension( &self, file: impl AsRef<Path> ) -> Option<Vec<&Language>>

Returns a list of all Language definitions identified by the extension of the given file.

source

fn get_languages_by_filename( &self, file: impl AsRef<Path> ) -> Option<Vec<&Language>>

Returns a list of all Language definitions identified by the name of the given file.

source

fn get_languages_by_interpreter( &self, interpreter: &str ) -> Option<Vec<&Language>>

Returns a list of all Language definitions identified by its interpreter.

source

fn get_heuristics_by_extension( &self, file: impl AsRef<Path> ) -> Option<&Vec<HeuristicRule>>

Returns a list of all HeuristicRule definitions identified by the extension of the given file.

Implementors§