globset

A Rust crate for matching one or more glob patterns against a path simultaneously

Library
Cargo
v0.4.20
67,385stars
MIT OR Unlicense

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity92
Maintenance96
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture84
Code Quality85
Innovation75
Learning Curve78

globset is a cross-platform Rust crate for glob pattern matching, distinguished by its ability to match many glob patterns against a single path simultaneously rather than testing each pattern one at a time. It works by compiling glob patterns into regular expressions and executing them through the regex crate, which lets it match large sets of patterns (as in a .gitignore-style ignore list) far faster than iterating over each glob individually. Maintained as part of Andrew Gallant’s (BurntSushi) ripgrep monorepo, globset is the pattern-matching engine underneath ripgrep’s own file filtering and the ignore crate’s directory-walking logic, and by download volume it is the more widely used of the two.

What You Get

  • Glob/GlobBuilder for compiling a single glob pattern into a matcher, with configuration for case sensitivity and literal path-separator semantics
  • GlobSet/GlobSetBuilder for combining many glob patterns into one matcher that tests a path against all of them simultaneously and returns which ones matched
  • Support for alternate ‘or’ globs (e.g. *.{foo,bar}), unlike Rust’s standard glob crate
  • Correct matching against non-UTF-8 file paths, important for cross-platform tools that must handle arbitrary filesystem bytes
  • An optional serde1 feature for (de)serializing Glob values, useful for loading glob patterns from configuration files

Common Use Cases

  • Implementing .gitignore-style ignore-pattern matching where many patterns must be checked against each candidate path efficiently
  • Building a file-search or linting tool that needs to filter files by one or more include/exclude glob patterns
  • Replacing per-pattern sequential glob matching (as with the glob crate) with a single combined matcher when checking many patterns against the same path repeatedly
  • Matching glob patterns loaded from a configuration file, using the serde1 feature to deserialize Glob values directly

Under The Hood

Architecture crates/globset/src/glob.rs (1,686 lines) implements the glob-to-regex compiler: it parses glob syntax (wildcards, character classes, brace alternation, literal separators) into an internal AST-like token sequence, then renders that into a regex-crate pattern string. crates/globset/src/lib.rs (1,307 lines) builds on that to provide the public Glob/GlobMatcher (single-pattern) and GlobSet/GlobSetBuilder (multi-pattern) types; GlobSet specifically concatenates many compiled glob-regexes into one RegexSet so a single execution pass can report every matching pattern’s index, which is the crate’s core performance idea. pathutil.rs handles path-normalization helpers needed for consistent cross-platform matching, fnv.rs provides a fast non-cryptographic hasher used internally, and serde_impl.rs implements the optional Serde (de)serialization support behind the serde1 feature. Tech Stack Pure Rust (edition 2024) with regex/regex-syntax and aho-corasick as its core matching dependencies, plus bstr for correct non-UTF-8 path handling; serde and log are optional, feature-gated dependencies rather than defaults. Benchmarks live in a separate benches directory using the bencher-style harness visible in the crate’s README performance numbers. Code Quality The crate has 27 inline #[test] functions across its five source files (13 in lib.rs alone, covering GlobSet construction and matching edge cases; 6 in glob.rs covering pattern-compilation correctness; 5 in serde_impl.rs), plus a benchmark suite that doubles as a performance regression check; CI runs through the shared ripgrep monorepo GitHub Actions workflow. As one of the older, most heavily downloaded crates in the ripgrep monorepo, its code has had years of production hardening across ripgrep, the ignore crate, and countless third-party consumers. API Design The single-glob API (Glob::new(pattern)?.compile_matcher()) is minimal and requires almost no setup for the common case; GlobSetBuilder follows the same builder pattern used throughout Rust’s ecosystem (.add() then .build()), so the multi-pattern API is a natural extension of the single-pattern one rather than a separate mental model, and the README’s direct performance comparisons against the glob crate make the tradeoffs explicit for users deciding between them.

Used by 5 apps in this directory

Rust
95%
MIT

claw-code

AI Agents · AI Code Assistants

195,087

A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.

View details
71
Repo Health
71
Technical
77
Dependency
Built with
Rust95%
Updated 3 days ago
Rust
52%
Apache 2.0

cocoindex

Data Engineering · AI Development

11,350

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
64
Dependency
Built with
Rust52%
Python48%
Updated yesterday
Python
74%
AGPL 3.0

OpenViking

Databases · AI Development

29,711

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
84
Repo Health
75
Technical
65
Dependency
Built with
Python74%
Rust14%
Updated today
Python
55%
Other

PostHog

Analytics · Monitoring · Developer Tools

37,777

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
67
Dependency
Built with
Python55%
TypeScript36%
Updated today
Rust
77%
AGPL 3.0

Spacedrive

File Storage · Collaboration

38,790

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
60
Repo Health
84
Technical
65
Dependency
Built with
Rust77%
TypeScript20%
Updated 3 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search