add content to deps
This commit is contained in:
@@ -7,9 +7,4 @@ description = "Canonical language contract for Prometeu Backend: identifiers, re
|
||||
repository = "https://github.com/prometeu/runtime"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"], optional = true }
|
||||
thiserror = "1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
serde = ["dep:serde"]
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SourcePolicy {
|
||||
pub extensions: Vec<&'static str>,
|
||||
pub case_sensitive: bool,
|
||||
}
|
||||
|
||||
impl SourcePolicy {
|
||||
pub fn matches_ext(&self, ext: &str) -> bool {
|
||||
if self.case_sensitive {
|
||||
self.extensions.iter().any(|e| *e == ext)
|
||||
} else {
|
||||
self.extensions.iter().any(|e| e.eq_ignore_ascii_case(ext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LanguageSpec {
|
||||
pub id: &'static str,
|
||||
pub source_policy: SourcePolicy,
|
||||
}
|
||||
@@ -1 +1,3 @@
|
||||
mod language_spec;
|
||||
|
||||
pub use language_spec::*;
|
||||
|
||||
Reference in New Issue
Block a user