Skip to main content

manifest_pattern_matches

Function manifest_pattern_matches 

Source
pub fn manifest_pattern_matches(filename: &str, pattern: &str) -> bool
Expand description

Whether filename matches a raw Ecosystem::manifest_patterns entry (e.g. "requirements*.txt").

Applies the same single-*-wildcard semantics EcosystemRegistry::register/EcosystemRegistry::get_for_filename use internally — but as a stateless, registry-free check.

Exposed so an ecosystem can ask “would my own manifest_patterns have matched this basename?” independently of an EcosystemRegistry instance — e.g. to gate a Ecosystem::manifest_directory_patterns-only match more strictly than a primary basename match (#452 S6): a file routed to an ecosystem purely by directory-name convention carries far weaker “this really is a manifest” evidence than one that also matches a basename pattern.

Returns false for a malformed pattern (no *, or more than one) rather than panicking — callers pass a &'static str they authored themselves, so this is a defensive fallback, not an expected runtime path.

§Examples

use deps_core::ecosystem_registry::manifest_pattern_matches;

assert!(manifest_pattern_matches("requirements-dev.txt", "requirements*.txt"));
assert!(!manifest_pattern_matches("base.txt", "requirements*.txt"));