jwalk/core/read_dir_spec.rs
1use std::path::Path;
2use std::sync::Arc;
3
4use crate::ClientState;
5
6/// Specification for reading a directory.
7///
8/// When a directory is read a new `ReadDirSpec` is created for each folder
9/// found in that directory. These specs are then sent to a work queue that is
10/// used to schedule future directory reads. Use
11/// [`max_depth`](struct.WalkDir.html#method.max_depth) and
12/// [`process_read_dir`](struct.WalkDir.html#method.process_read_dir) to change
13/// this default behavior.
14#[derive(Debug)]
15pub struct ReadDirSpec<C: ClientState> {
16 /// Depth of the directory to read relative to root of walk.
17 pub depth: usize,
18 /// Path of the the directory to read.
19 pub path: Arc<Path>,
20 /// Client branch state that was set in the
21 /// [`process_read_dir`](struct.WalkDir.html#method.process_read_dir) callback
22 /// when reading this directory's parent. One intended use case is to store
23 /// `.gitignore` state to filter entries during the walk.
24 pub client_read_state: C::ReadDirState,
25 // Origins of symlinks followed to get to this entry.
26 pub(crate) follow_link_ancestors: Arc<Vec<Arc<Path>>>,
27}