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§
sourcefn get_language_by_name(&self, name: &str) -> Option<&Language>
fn get_language_by_name(&self, name: &str) -> Option<&Language>
Returns a list of all Language
definitions identified by its name.
sourcefn get_languages_by_extension(
&self,
file: impl AsRef<Path>
) -> Option<Vec<&Language>>
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.
sourcefn get_languages_by_filename(
&self,
file: impl AsRef<Path>
) -> Option<Vec<&Language>>
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.
sourcefn get_languages_by_interpreter(
&self,
interpreter: &str
) -> Option<Vec<&Language>>
fn get_languages_by_interpreter( &self, interpreter: &str ) -> Option<Vec<&Language>>
Returns a list of all Language
definitions identified by its interpreter.
sourcefn get_heuristics_by_extension(
&self,
file: impl AsRef<Path>
) -> Option<&Vec<HeuristicRule>>
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.