#[non_exhaustive]pub struct ScanConfig {
pub max_file_size_bytes: Option<u64>,
pub excludes: Vec<Glob>,
pub follow_symlinks: bool,
}Expand description
Configuration for a Scanner. Construct via ScanConfig::default
then layer on options with the with_* / add_* builder methods,
or build from struct literal during the same crate.
#[non_exhaustive] — same forward-compat reasoning as
ScanEntry.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_file_size_bytes: Option<u64>Skip files whose size exceeds this limit, in bytes. None
means no cap (the default — a Scanner::walk call will
happily yield a 50 GB file if the caller asked for it).
excludes: Vec<Glob>walk only.Glob patterns matched against the full path; matching files
(and directories — globs match **/.git/** against e.g.
/Users/me/proj/.git/HEAD and exclude the whole subtree)
are silently skipped. Empty by default; build the set with
ScanConfig::add_exclude.
We hold the source Globs rather than a built GlobSet
because GlobSet is immutable post-build and doesn’t expose
its members for round-tripping. Scanner::new builds the
GlobSet once at construction time from this list.
follow_symlinks: boolWhen true, follow symlinks as if they were real files. When
false (default), symlinks are skipped. Following symlinks
risks both infinite loops (handled by walkdir) and crossing
out of the tree the user thought they were scanning.
Implementations§
Source§impl ScanConfig
impl ScanConfig
Sourcepub fn max_file_size_bytes(self, bytes: u64) -> Self
pub fn max_file_size_bytes(self, bytes: u64) -> Self
Set the per-file size cap. Files larger than bytes are
silently skipped during the walk.
Sourcepub fn follow_symlinks(self, follow: bool) -> Self
pub fn follow_symlinks(self, follow: bool) -> Self
Toggle symlink following. Off by default.
Sourcepub fn add_exclude(self, pattern: &str) -> Result<Self>
Available on crate feature walk only.
pub fn add_exclude(self, pattern: &str) -> Result<Self>
walk only.Add a glob pattern to the exclude set. Patterns are matched
against the full absolute path; use ** to match any path
segment.
Examples:
**/.git/**— exclude every.gitdirectory**/*.log— exclude every.logfile**/node_modules/**— exclude everynode_modulestree
Returns Self so calls can chain. Returns Err when the
pattern is malformed (typically a stray \ or unbalanced
[...]).
Trait Implementations§
Source§impl Clone for ScanConfig
impl Clone for ScanConfig
Source§fn clone(&self) -> ScanConfig
fn clone(&self) -> ScanConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more