pub struct CompiledCatalog { /* private fields */ }Expand description
Compiled catalog for fast filename matching.
Uses a single GlobMap with an optimized MatchEngine that automatically
dispatches to the fastest strategy per pattern (literal hash, extension hash,
prefix/suffix tries, Aho-Corasick pre-filter).
Implementations§
Source§impl CompiledCatalog
impl CompiledCatalog
Sourcepub fn compile(catalog: &Catalog) -> Self
pub fn compile(catalog: &Catalog) -> Self
Compile a catalog into a matcher.
Entries with no fileMatch patterns are skipped.
Negation patterns (starting with !) are skipped.
Patterns without / are prepended with **/ so they match at any depth.
§Panics
Panics if an empty GlobMap cannot be constructed (should never happen).
Sourcepub fn find_schema(&self, path: &str, _file_name: &str) -> Option<&str>
pub fn find_schema(&self, path: &str, _file_name: &str) -> Option<&str>
Find the schema URL for a given file path.
path is the full path string, file_name is the basename.
Returns the first matching schema URL, or None.
Sourcepub fn find_schema_detailed<'a>(
&'a self,
path: &str,
_file_name: &'a str,
) -> Option<SchemaMatch<'a>>
pub fn find_schema_detailed<'a>( &'a self, path: &str, _file_name: &'a str, ) -> Option<SchemaMatch<'a>>
Find the schema for a given file path, returning detailed match info.
Returns the URL, the matched pattern, all fileMatch globs, the schema
name, and the description from the catalog entry.
Sourcepub fn schema_name(&self, url: &str) -> Option<&str>
pub fn schema_name(&self, url: &str) -> Option<&str>
Look up the human-readable schema name for a given URL.