parex
Blazing-fast parallel search engine — generic, embeddable, zero opinions.
parex is a Rust library that owns the parallel walk engine, the trait contracts, and the error type. It does not own filesystem logic, output formatting, or built-in matchers — those belong to the caller.
Built to power ldx.
Features
- Parallel traversal via a clean
Sourcetrait — search files, databases, memory, anything - Custom matching via a
Matchertrait — substring, regex, fuzzy, metadata, ML scoring - Typed error handling with
is_recoverable()— callers decide what to skip vs halt - Opt-in path and error collection — zero allocation overhead when unused
#![forbid(unsafe_code)]
Quick Start
[]
= "0.1"
Implement Source for whatever you want to search:
use ;
use WalkConfig;
;
Run a search:
let results = search
.source
.matching
.limit
.threads
.collect_paths
.collect_errors
.run?;
println!;
for path in &results.paths
for err in &results.errors
Custom Matchers
use ;
;
let results = search
.source
.with_matcher
.collect_paths
.run?;
Builder API
| Method | Description |
|---|---|
.source(s) |
Set the source to search |
.matching(pattern) |
Substring match — case-insensitive shorthand |
.with_matcher(m) |
Custom Matcher implementation |
.limit(n) |
Stop after n matches |
.threads(n) |
Thread count (default: logical CPUs) |
.max_depth(d) |
Maximum traversal depth |
.collect_paths(bool) |
Collect matched paths into Results::paths |
.collect_errors(bool) |
Collect recoverable errors into Results::errors |
Error Handling
for err in &results.errors
Design
parex owns the walk engine, trait contracts, error type, and builder API. It does not own filesystem logic, output formatting, or concrete matchers — those live in the tool built on top.
See PAREX_DESIGN.md for the full architecture document.
License
MIT — see LICENSE