Struct wax::walk::WalkBehavior
source · pub struct WalkBehavior {
pub depth: usize,
pub link: LinkBehavior,
}walk only.Expand description
Configuration for walking directory trees.
Determines the behavior of the traversal within a directory tree when using functions like
Glob::walk_with_behavior. WalkBehavior can be constructed via conversions from types
representing its fields. APIs generally accept impl Into<WalkBehavior>, so these conversion
can be used implicitly. When constructed using such a conversion, WalkBehavior will use
defaults for any remaining fields.
Examples
By default, symbolic links are interpreted as regular files and targets are ignored. To read
linked targets, use LinkBehavior::ReadTarget.
use wax::walk::LinkBehavior;
use wax::Glob;
for entry in Glob::new("**")
.unwrap()
.walk_with_behavior(".", LinkBehavior::ReadTarget)
{
let entry = entry.unwrap();
// ...
}Fields§
§depth: usizeMaximum depth.
Determines the maximum depth to which a directory tree will be traversed relative to the root. A depth of zero corresponds to the root and so using such a depth will yield at most one file entry that refers to the root.
For PathExt::walk, this depth is relative to the Path receiver. For Glob::walk,
this depth is relative to the directory path parameter.
The default value is usize::MAX.
link: LinkBehaviorInterpretation of symbolic links.
Determines how symbolic links are interpreted when walking a directory tree. See
LinkBehavior.
The default value is LinkBehavior::ReadFile.
Trait Implementations§
source§impl Clone for WalkBehavior
impl Clone for WalkBehavior
source§fn clone(&self) -> WalkBehavior
fn clone(&self) -> WalkBehavior
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for WalkBehavior
impl Debug for WalkBehavior
source§impl Default for WalkBehavior
impl Default for WalkBehavior
Constructs a WalkBehavior using the following defaults:
| Field | Description | Value |
|---|---|---|
depth | Maximum depth. | usize::MAX |
link | Interpretation of symbolic links. | LinkBehavior::ReadFile |
source§impl From<()> for WalkBehavior
impl From<()> for WalkBehavior
source§impl From<LinkBehavior> for WalkBehavior
impl From<LinkBehavior> for WalkBehavior
source§fn from(link: LinkBehavior) -> Self
fn from(link: LinkBehavior) -> Self
source§impl From<usize> for WalkBehavior
impl From<usize> for WalkBehavior
source§impl PartialEq<WalkBehavior> for WalkBehavior
impl PartialEq<WalkBehavior> for WalkBehavior
source§fn eq(&self, other: &WalkBehavior) -> bool
fn eq(&self, other: &WalkBehavior) -> bool
self and other values to be equal, and is used
by ==.