ripgrep—as we mentioned in the previous recipe (Extracting text using regular expressions)—is a popular grep engine that walks through files to find anything that matches the provided regular expression rules. For that, it's not only necessary to compile and match a regular expression to massive amounts of text, but also to find these texts. To get to and open these files, we need to walk the directory trees of the filesystem. Let's find out how to do that in Rust.
Recursively searching the filesystem
How to do it...
We can understand recursive search by following a few steps:
- Open a Terminal to create a new project using cargo new filesystem. Use VS Code to open the project directory.
- Edit Cargo.toml...