-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor walk features and the
walk
module.
This change significantly refactors the `walk` module and its features. Changes were motivated by issue #49, which describes poor performance when walking directory trees. Filters did not properly compose, so if a glob discards a directory but not its tree, then a `not` combinator does not observe the file and so does not discard the tree when necessary. Major changes include: 1. The `walk` module is now a part of the public API. 2. Unfiltered walking is provided via `PathExt`. 3. `FileIterator` is now very general: any `FileIterator` supports `filter_entry` and `not` combinators. 4. Issue #49 is fixed and any and all filtering is composed monotonically such that all filters observe both filtrate and residue. 5. `Glob::walk` is no longer implemented via a macro and `for_each_ref` has been removed. 6. The walk integration tests have been refactored into unit tests in the `walk` module and the feed of the `not` combinator is tested. 7. The MSRV has been bumped to `1.66.1` for opaque lifetime features. To compose filters, a `filter` module has been added that implements separating filters, which are much like iterators and perform per-item partitioning. Items are known as the feed and are one of two variants: filtrate or residue. Filter mapping allows only monotonic separation with special support for hierarchical tree iterators where there are two residue variants: node and tree. Filtering by tree has an important side effect: it uses a cancellation token to cancel the walk into the sub-tree of that item, completely discarding it. The paths used when matching a `Glob` against a directory tree have been implemented in terms of the root path (a `PathBuf`) and a prefix in that root path represented as a `usize`. A similar approach is used for entries, such that they can cheaply implement a `root_relative_paths` function to split the path into its root and relative parts.
- Loading branch information
1 parent
303b5d6
commit 76afaa1
Showing
10 changed files
with
2,533 additions
and
1,361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.