ferralk-glob 1.1.0

Compiled, byte-first glob matching with explicit wildcard, brace, and extglob semantics.
Documentation

ferralk-glob

ferralk-glob compiles a glob once and matches it many times against arbitrary bytes, so filenames never pass through a lossy UTF-8 conversion. Syntax that changes meaning stays explicit through PatternOptions.

use ferralk_glob::{Pattern, PatternOptions};

let source_file = Pattern::compile("src/**/*.{rs,toml}", PatternOptions::walker())?;

assert!(source_file.is_match_glob_path("src/lib.rs"));
assert!(!source_file.is_match_glob_path("src/generated/lib.rs.bak"));
# Ok::<(), ferralk_glob::PatternError>(())

Wildcard scope comes from the matching entry point. is_match_glob_path keeps every ordinary wildcard in one component, as a shell glob does, and is the entry point for filesystem paths. is_match is separator-agnostic. is_match_path keeps zlob's list-filter rule, where a root wildcard may cross separators but wildcards after an explicit separator are component-local. With recursive_double_star disabled, ** is equivalent to *; enable it to make a ** that forms a whole path component (**/x, x/**, x/**/y) recursive. Any other star run stays ordinary, so **/x never matches sx. Braces, extglobs, hidden-name matching, ASCII case folding, and changed escaping remain explicit opt-ins. PatternOptions::default() enables none of them; PatternOptions::walker() enables recursive **, braces, and extglobs, the dialect the ferralk walker reads its include and exclude patterns in. For a list of globs, PatternSet is the globset::GlobSet counterpart: it answers exactly as its patterns would one by one, and asks only those whose literals a path contains.

For the full syntax, error contract, compatibility notes, and tested recipes (matching against several globs, porting a fast-glob list, escaping literal text), see the crate documentation, the usage guide, and the Ferralk repository.

ferralk is part of the Ferramenta family — A family of Rust tools.

Siblings: ferroni — Oniguruma-compatible regex engine · ferriki — Shiki-compatible syntax highlighting · ferromark — Markdown to HTML with a secure default and every GFM extension included. · ferrolex — Spell checking for text and code · ferrocat — Translation catalog engine · palamedes — Internationalization for TypeScript applications · ferrovia — SVGO-compatible SVG optimizer · ferrugo — PDF previews for untrusted files.

Built by Sebastian Software.