API Reference
walkdir
Recursively walk directory trees in Rust with an iterator, filtering, and depth control.
Official Documentation ↗CompatibilityThis documentation covers version
v2.5. Check the official docs for the latest API surface.Installation
cargo
cargo add walkdirMethods
No methods match this filter.
walkdir yields entries depth-first and lets you filter entries and limit traversal depth.
Key Features
- Iterator over directory entries
- filter_entry for pruning directories
- Depth and symlink controls
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The following points are quoted verbatim from the official documentation. 来源:https://docs.rs/walkdir/latest/walkdir/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:53:23.974Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Finally, the Error type is a small wrapper around std::io::Error with additional information, such as if a loop was detected while following symbolic links (not enabled by default). (https://docs.rs/walkdir/latest/walkdir/)
FAQ
- How do I skip a whole directory subtree?
- Use filter_entry; returning false prunes the directory and its contents, unlike a plain filter.
- Does it follow symlinks?
- Only with follow_links(true). Enabling it can create cycles and infinite loops, so pair it with max_depth.
- How are errors surfaced?
- Each item is a Result, so handle errors per entry to continue past unreadable paths.
Report a problem with this API docOpens a pre-filled issue on GitHub.