[][src]Struct fwalker::Walker

pub struct Walker { /* fields omitted */ }

Methods

impl Walker[src]

pub fn new() -> Result<Walker, Error>[src]

Create a new Walker starting from the current directory (path .). This Walker will not follow symlinks and will not have any limitation in recursion depth for directories.

pub fn from<T: Into<PathBuf>>(path: T) -> Result<Walker, Error>[src]

Create a new Walker for the given path. This Walker will not follow symlinks and will not have any limitation in recursion depth for directories.

With a directory structure of

file0
dir0/
├── file1
├── file2
├── empty_dir/
├── .hidden_dir/
│   └── file3
└── .hidden_file

the Walker should return the files as following

use std::path::PathBuf;

let walker = fwalker::Walker::from("test_dirs")?;
let found_files: usize = walker.count();
assert_eq!(5, found_files);

Walker::from takes any argument that can be coverted into a PathBuf, so the following is possible as well

let mut walker = fwalker::Walker::from("test_dirs")?;
assert!(walker.next().is_some());

pub fn max_depth(self, depth: u32) -> Walker[src]

Modifies the current instance of a Walker, retaining the current configuration for the Walker, but setting the maximum recursion depth to the maximum value of depth.

Enable following of symlinks on the current Walker when traversing through files. Once this option has been enabled for a Walker, it cannot be disabled again.

pub fn reset(&mut self) -> &mut Walker[src]

Reset a Walker to its original state, starting over with iterating from the origin PathBuf. Changes made to the Walker after it was created with max_depth() and follow_symlinks() will not be reseted.

Unlike when the Walker was initially created, no validation will be done that the path actually exists or that it is a directory, since both of these conditions must have been met when the Walker was created.

Trait Implementations

impl Clone for Walker[src]

impl Debug for Walker[src]

impl Default for Walker[src]

impl Display for Walker[src]

impl Eq for Walker[src]

impl Hash for Walker[src]

impl Iterator for Walker[src]

type Item = PathBuf

The type of the elements being iterated over.

impl Ord for Walker[src]

impl PartialEq<Walker> for Walker[src]

impl PartialOrd<Walker> for Walker[src]

impl StructuralEq for Walker[src]

impl StructuralPartialEq for Walker[src]

Auto Trait Implementations

impl RefUnwindSafe for Walker

impl Send for Walker

impl Sync for Walker

impl Unpin for Walker

impl UnwindSafe for Walker

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.