Crate xvc_walker
source ·Expand description
Xvc walker traverses directory trees with ignore rules.
Ignore rules are similar to .gitignore and child directories are not traversed if ignored.
walk_parallel function is the most useful element in this module. It walks and sends PathMetadata through a channel, also updating the ignore rules and sending them.
Re-exports
Modules
An absolute path type to ensure that we don’t use relative paths.
Error codes and messages for Xvc Walker
A libnotify based file system notification module that considers ignore rules.
Macros
Derive macro generating an impl of the trait
Hash.Structs
Glob represents a successfully parsed shell glob pattern.
GlobSet represents a group of globs that can be matched together in a
single pass.
GlobSetBuilder builds a group of patterns that can be used to
simultaneously match a file path.
Complete set of ignore rules for a directory and its child directories.
Combine a path and its metadata in a single struct
Pattern is generic and could be an instance of String, Glob, Regex or any other object.
The type is evolved by compiling.
A pattern can start its life as
Pattern<String> and can be compiled into Pattern<Glob> or
Pattern<Regex>.What’s the ignore file name and should we add directories to the result?
Enums
Show whether a path matches to a glob rule
Is the path only a directory, or could it be directory or file?
Is this pattern a ignore or whitelist patter?
Is the pattern matches anywhere or only relative to a directory?
Do we get this pattern from a file (.gitignore, .xvcignore, …) or specify it directly in
code?
Traits
A hashable type.
Functions
Just build the ignore rules with the given directory
Check whether
path is whitelisted or ignored with ignore_rulesconvert a set of rules in
content to glob patterns.
patterns may come from source.
the root directory of all search is in ignore_root.Return all childs of a directory regardless of any ignore rules
If there is an error to obtain the metadata, error is added to the element instead
merge ignore rules in a single set of ignore rules.
Walk all child paths under
dir and send non-ignored paths to path_sender.
Newly found ignore rules are sent through ignore_sender.
The ignore file name (.xvcignore, .gitignore, .ignore, …) is set by walk_options.Walk
dir with walk_options, with the given initial ignore_rules.
Note that ignore rules are expanded with the rules given in the ignore_filename in
walk_options.
The result is added to given res_paths to reduce the number of memory inits for vec.