pub struct LanguageRegistry { /* private fields */ }Expand description
Ordered language registry with last-registration-wins extension lookup.
Implementations§
Source§impl LanguageRegistry
impl LanguageRegistry
Sourcepub fn register(&mut self, spec: LanguageSpec) -> LanguageId
pub fn register(&mut self, spec: LanguageSpec) -> LanguageId
Registers a language and returns its stable identifier.
When an extension was already registered, this specification becomes the extension’s new owner.
Sourcepub const fn generation(&self) -> u64
pub const fn generation(&self) -> u64
Returns the number of registry mutations observed so far.
Sourcepub fn for_path(&self, path: &Path) -> Option<LanguageId>
pub fn for_path(&self, path: &Path) -> Option<LanguageId>
Resolves a path by its final file extension.
Sourcepub fn get(&self, id: LanguageId) -> Option<&LanguageSpec>
pub fn get(&self, id: LanguageId) -> Option<&LanguageSpec>
Returns the specification for an identifier.
Sourcepub fn supports_symbols(&self, path: &Path) -> bool
pub fn supports_symbols(&self, path: &Path) -> bool
Returns whether the path has a registered symbol query.
Sourcepub fn supports_imports(&self, path: &Path) -> bool
pub fn supports_imports(&self, path: &Path) -> bool
Returns whether the path has a registered import extractor.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = (LanguageId, &LanguageSpec)>
pub fn iter(&self) -> impl ExactSizeIterator<Item = (LanguageId, &LanguageSpec)>
Iterates over registered identifiers and specifications in registration order.
Trait Implementations§
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