pub struct LanguageRegistry { /* private fields */ }Expand description
Ordered set of language plugins with a guaranteed generic fallback.
Implementations§
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn register(&mut self, lang: Box<dyn Language>)
pub fn register(&mut self, lang: Box<dyn Language>)
Register a plugin. First registered, first asked; the generic fallback always answers last.
pub fn detect(&self, path: &[u8]) -> &dyn Language
Sourcepub fn fingerprint(&self) -> String
pub fn fingerprint(&self) -> String
Cache-key component: shape hashes depend on normalisation, so anything pinned to a partition (e.g. the future grouping cache) must include this. Two registries with the same fingerprint classify identically.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LanguageRegistry
impl !UnwindSafe for LanguageRegistry
impl Freeze for LanguageRegistry
impl Send for LanguageRegistry
impl Sync for LanguageRegistry
impl Unpin for LanguageRegistry
impl UnsafeUnpin 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