fn filter_entry<F>(self, f: F) -> FilterEntry<Self, F>
    where
        Self: Sized,
        F: FnMut(&dyn Entry) -> Option<EntryResidue>,
    {
        FilterEntry { input: self, f }
    }
Filters file entries and controls the traversal of the directory tree.

This function constructs a combinator that filters file entries and
furthermore specifies how iteration proceeds to traverse the
directory tree. It accepts a function that, when discarding an
entry, returns an [`EntryResidue`]. If an entry refers to a directory
and the filtering function returns [`EntryResidue::Tree`], then
iteration does **not** descend into that directory and the tree is
**not** read from the file system.

The filtering function is called even when a composing filter has
already discarded a file entry. This allows filtering combinators to
observe previously filtered entries and potentially discard a
directory tree regardless of how they are composed. Filtering is
monotonic, meaning that filtered entries can only progress forward from
unfiltered `None` to filtered file `Some(EntryResidue::File)` to
filtered tree `Some(EntryResidue::Tree)`. An entry cannot be
"unfiltered" and if a subsequent combinator specifies a lesser filter,
then it has no effect.

**Prefer this combinator over functions like [`Iterator::filter`] when
discarded directories need not be read.**

# Examples

The [`FilterEntry`] combinator can apply arbitrary and non-nominal
filtering that avoids unnecessary directory reads. The following
example filters out hidden files on Unix and Windows. On Unix,
hidden files are filtered out nominally via [`not`]. On Windows,
`filter_entry` instead detects the [hidden attribute][attributes]. In
both cases, the combinator does not read conventionally hidden
directory trees.

```rust,no_run
use wax::walk::{Entry, FileIterator};
use wax::Glob;

let glob = Glob::new("**/*.(?i){jpg,jpeg}").unwrap();
let walk = glob.walk("./Pictures");
// Filter out nominally hidden files on Unix. Like `filter_entry`, `not` does not perform
// unnecessary reads of directory trees.
#[cfg(unix)]
let walk = walk.not(["**/.*/**"]).unwrap();
// Filter out files with the hidden attribute on Windows.
#[cfg(windows)]
let walk = walk.filter_entry(|entry| {
use std::os::windows::fs::MetadataExt as _;
use wax::walk::EntryResidue;

const ATTRIBUTE_HIDDEN: u32 = 0x2;

let attributes = entry.metadata().unwrap().file_attributes();
if (attributes & ATTRIBUTE_HIDDEN) == ATTRIBUTE_HIDDEN {
// Do not read hidden directory trees.
Some(EntryResidue::Tree)
}
else {
None
}
});
for entry in walk {
let entry = entry.unwrap();
println!("JPEG: {:?}", entry.path());
}
```

[`EntryResidue`]: crate::walk::EntryResidue
[`EntryResidue::Tree`]: crate::walk::EntryResidue::Tree
[`FilterEntry`]: crate::walk::FilterEntry
[`Iterator::filter`]: std::iter::Iterator::filter
[`not`]: crate::walk::FileIterator::not

[attributes]: https://docs.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
crates/turborepo-wax/src/walk/mod.rs