[][src]Struct fwalker::FileWalker

pub struct FileWalker { /* fields omitted */ }

Methods

impl FileWalker[src]

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

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

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

Create a new FileWalker for the given path. This FileWalker 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 FileWalker should return the files as following

use std::path::PathBuf;

let walker = walker::FileWalker::from("test_dirs").unwrap();
let found_files: usize = walker.count();
assert_eq!(5, found_files);

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

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

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

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

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

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

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

Unlike when the FileWalker 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 FileWalker was created.

Trait Implementations

impl Clone for FileWalker[src]

impl Debug for FileWalker[src]

impl Default for FileWalker[src]

impl Display for FileWalker[src]

impl Eq for FileWalker[src]

impl Hash for FileWalker[src]

impl Iterator for FileWalker[src]

type Item = PathBuf

The type of the elements being iterated over.

impl Ord for FileWalker[src]

impl PartialEq<FileWalker> for FileWalker[src]

impl PartialOrd<FileWalker> for FileWalker[src]

impl StructuralEq for FileWalker[src]

impl StructuralPartialEq for FileWalker[src]

Auto Trait Implementations

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.