pub enum FileKey {
Extension(FileExtension),
Name(FileName),
Unmappable,
}Expand description
What identifies a file to a LanguageMap.
A file with an extension is identified by it, so a name key never competes
with an extension key: FileName has no dot.
Variants§
Extension(FileExtension)
The file’s extension, as Path::extension reports it.
Name(FileName)
The name of a file without an extension.
Unmappable
The file has no extension or name that can be configured, such as a dotfile or a name with non-ASCII characters.
Implementations§
Source§impl FileKey
impl FileKey
Sourcepub fn of(path: &Path) -> Self
pub fn of(path: &Path) -> Self
The key identifying path.
§Examples
use std::path::Path;
use mcpls_core::config::{FileExtension, FileKey, FileName};
assert_eq!(
FileKey::of(Path::new("src/main.rs")),
FileKey::Extension(FileExtension::from_static("rs"))
);
assert_eq!(
FileKey::of(Path::new("build/Makefile")),
FileKey::Name(FileName::from_static("Makefile"))
);
assert_eq!(FileKey::of(Path::new(".gitignore")), FileKey::Unmappable);Trait Implementations§
impl Eq for FileKey
impl StructuralPartialEq for FileKey
Auto Trait Implementations§
impl Freeze for FileKey
impl RefUnwindSafe for FileKey
impl Send for FileKey
impl Sync for FileKey
impl Unpin for FileKey
impl UnsafeUnpin for FileKey
impl UnwindSafe for FileKey
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.