Skip to main content

CompiledCatalog

Struct CompiledCatalog 

Source
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

Source

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).

Source

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.

Source

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.

Source

pub fn schema_name(&self, url: &str) -> Option<&str>

Look up the human-readable schema name for a given URL.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.