Open-Source Wikis

/

ripgrep

/

Packages

/

grep

BurntSushi/ripgrep

grep

Active contributors: Andrew Gallant

Purpose

crates/grep is a thin facade crate that re-exports the public APIs of the other library crates so downstream consumers can pull in a single dependency. It is the recommended entry point for embedding ripgrep's search engine in another Rust program.

The crate has no original code: its src/lib.rs is six lines of pub extern crate statements. The interesting bit is the dependency list in crates/grep/Cargo.toml, which pins compatible versions of every other workspace library.

Directory layout

crates/grep/
├── Cargo.toml      # Pins versions of grep-cli, grep-matcher, grep-pcre2, grep-printer, grep-regex, grep-searcher
├── src/lib.rs      # Six pub extern crate lines
└── examples/
    └── (example programs that use the facade)

Source

// crates/grep/src/lib.rs
pub extern crate grep_cli as cli;
pub extern crate grep_matcher as matcher;
#[cfg(feature = "pcre2")]
pub extern crate grep_pcre2 as pcre2;
pub extern crate grep_printer as printer;
pub extern crate grep_regex as regex;
pub extern crate grep_searcher as searcher;

So grep::matcher::Matcher, grep::searcher::Searcher, grep::printer::Standard, etc. are all available.

Features

The crate exposes one feature, pcre2, which forwards to grep-pcre2's feature flag and enables the grep::pcre2 re-export.

The simd-accel and avx-accel features are deprecated no-ops; SIMD dispatch happens at runtime in the underlying regex crate.

When to use it

  • Embedding ripgrep-style search in a Rust application: depend on grep.
  • Implementing a custom Matcher for a non-regex search: depend only on grep-matcher.
  • Writing a custom Sink for search results: depend on grep-searcher and grep-matcher.

Integration points

  • The ripgrep binary (crates/core) does not depend on grep directly; it depends on the underlying crates individually. The facade exists for external users, not for the binary.

Entry points for modification

This crate rarely changes. Updates happen when:

  • A new library crate is added to the workspace and should be reexported.
  • A library crate's feature flags change (e.g., simd-accel removal).

If you bump a member crate's version, also bump the matching dependency in crates/grep/Cargo.toml so external users get the new version through the facade.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

grep – ripgrep wiki | Factory