MCPcopy Index your code
hub / github.com/Byron/jwalk

github.com/Byron/jwalk @v0.8.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.8.1 ↗ · + Follow
180 symbols 847 edges 17 files 45 documented · 25% updated 7mo agov0.8.1 · 2022-12-15★ 2858 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

jwalk

Filesystem walk.

  • Performed in parallel using rayon
  • Entries streamed in sorted order
  • Custom sort/filter/skip/state

Build Status Latest version

Usage

Add this to your Cargo.toml:

[dependencies]
jwalk = "0.5"

Lean More: docs.rs/jwalk

Example

Recursively iterate over the "foo" directory sorting by name:

use jwalk::{WalkDir};

for entry in WalkDir::new("foo").sort(true) {
  println!("{}", entry?.path().display());
}

Inspiration

This crate is inspired by both walkdir and ignore. It attempts to combine the parallelism of ignore with walkdir's streaming iterator API. Some code and comments are copied directly from walkdir.

Why use this crate?

This crate is particularly good when you want streamed sorted results. In my tests it's about 4x walkdir speed for sorted results with metadata. Also this crate's process_read_dir callback allows you to arbitrarily sort/filter/skip/state entries before they are yielded.

Why not use this crate?

Directory traversal is already pretty fast. If you don't need this crate's speed then walkdir provides a smaller and more tested single threaded implementation.

This crates parallelism happens at the directory level. It will help when walking deep file systems with many directories. It wont help when reading a single directory with many files.

Benchmarks

Benchmarks comparing this crate with walkdir and ignore.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 97
Function 62
Class 16
Enum 4
Interface 1

Languages

Rust100%

Modules by API surface

tests/integration.rs52 symbols
src/lib.rs21 symbols
tests/util/mod.rs19 symbols
src/core/error.rs18 symbols
src/core/ordered_queue.rs17 symbols
src/core/dir_entry.rs13 symbols
src/core/index_path.rs10 symbols
src/core/run_context.rs6 symbols
src/core/ordered.rs5 symbols
src/core/read_dir_iter.rs4 symbols
src/core/read_dir.rs4 symbols
src/core/dir_entry_iter.rs4 symbols

For agents

$ claude mcp add jwalk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page