pub struct LanguageRegistry { /* private fields */ }Expand description
A lightweight in-memory registry of language configurations.
Implementations§
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn register(
&mut self,
lang: LanguageConfig,
) -> Result<(), LanguageRegistryError>
pub fn register( &mut self, lang: LanguageConfig, ) -> Result<(), LanguageRegistryError>
Register a language config.
Sourcepub fn languages(&self) -> &[LanguageConfig]
pub fn languages(&self) -> &[LanguageConfig]
Return all registered languages.
Sourcepub fn by_id(&self, id: &str) -> Option<&LanguageConfig>
pub fn by_id(&self, id: &str) -> Option<&LanguageConfig>
Find a language config by its id.
Sourcepub fn language_for_path(&self, path: &Path) -> Option<&LanguageConfig>
pub fn language_for_path(&self, path: &Path) -> Option<&LanguageConfig>
Find a language config for a file path.
Trait Implementations§
Source§impl Clone for LanguageRegistry
impl Clone for LanguageRegistry
Source§fn clone(&self) -> LanguageRegistry
fn clone(&self) -> LanguageRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LanguageRegistry
impl Debug for LanguageRegistry
Auto Trait Implementations§
impl Freeze for LanguageRegistry
impl RefUnwindSafe for LanguageRegistry
impl Send for LanguageRegistry
impl Sync for LanguageRegistry
impl Unpin for LanguageRegistry
impl UnsafeUnpin for LanguageRegistry
impl UnwindSafe for LanguageRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more