Skip to main content

Module engine

Module engine 

Source
Expand description

The in-process corpus engine.

Search uses ripgrep’s own crates (grep, ignore, globset) linked directly into the process — the same matching/walking engine as the rg binary, but with no subprocess and therefore no shell-injection surface.

All functions here are synchronous and blocking; callers on an async runtime should dispatch them via spawn_blocking (the tool layer does this).

Structs§

DirEntryInfo
A directory entry returned by list_dir.
FindQuery
Parameters for a find call.
FindResult
Result of a find call.
ListResult
Result of a list_dir call.
NumberedLine
A numbered line returned by read_range.
ReadResult
Result of a read_range call.
SearchHit
A single line emitted by search, either a match or surrounding context.
SearchQuery
Parameters for a search call.
SearchResult
Result of a search call.

Functions§

find
Find files whose corpus-relative path matches a glob.
list_dir
List the immediate entries of a directory inside the corpus.
list_files
Enumerate every file in the corpus as a corpus-relative path, honoring the walk limits (gitignore, hidden, max_files_walked).
read_document
Read a whole file (bounded by max_file_bytes) as UTF-8 (lossy), resolving the path through the corpus jail.
read_range
Read a bounded, line-numbered window from a single file.
search
Run a regular-expression search across the corpus.