pub struct ResolverRegistry { /* private fields */ }Expand description
Registry of Code Resolvers by file extension. Uses an FxHashMap for O(1) extension lookup instead of linear scan.
Implementations§
Source§impl ResolverRegistry
impl ResolverRegistry
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a registry with all built-in resolvers registered.
Sourcepub fn register(&mut self, resolver: Box<dyn CodeResolver>)
pub fn register(&mut self, resolver: Box<dyn CodeResolver>)
Register a resolver, indexing it by each extension it supports.
Sourcepub fn get_for_file(&self, file_path: &Path) -> Option<&dyn CodeResolver>
pub fn get_for_file(&self, file_path: &Path) -> Option<&dyn CodeResolver>
Look up the resolver for a file based on its extension.
Sourcepub fn has_resolver_for(&self, file_path: &Path) -> bool
pub fn has_resolver_for(&self, file_path: &Path) -> bool
Return true if a resolver exists for this file’s extension.
Return all unique code element tags across all registered resolvers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResolverRegistry
impl !RefUnwindSafe for ResolverRegistry
impl Send for ResolverRegistry
impl Sync for ResolverRegistry
impl Unpin for ResolverRegistry
impl UnsafeUnpin for ResolverRegistry
impl !UnwindSafe for ResolverRegistry
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more