[][src]Struct fwalker::Walker

pub struct Walker { /* fields omitted */ }

Implementations

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 with_capacity(capacity: usize) -> Result<Walker, Error>[src]

Create a new Walker starting from the current directory (path .), with the given initial capacity for the internal vectors used to store files and directories.

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 with an initial capacity of 16. 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 from_with_capacity<T: Into<PathBuf>>(
    path: T,
    capacity: usize
) -> Result<Walker, Error>
[src]

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

pub fn max_depth(mut self: Self, depth: Option<u32>) -> Walker

Notable traits for Walker

impl Iterator for Walker type Item = PathBuf;
[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 only_local_fs(mut self: Self, enable: bool) -> Walker

Notable traits for Walker

impl Iterator for Walker type Item = PathBuf;
[src]

Prevent the Walker from entering other file systems while traversing a directory structure. This means that subdirectories of a directory that belongs to another file system will be ignored.

pub fn reset(&mut self) -> &mut Walker

Notable traits for Walker

impl Iterator for Walker type Item = PathBuf;
[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 reset.

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]

impl TryFrom<&'_ PathBuf> for Walker[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ str> for Walker[src]

type Error = Error

The type returned in the event of a conversion error.

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> Pointable for T

type Init = T

The type for initializers.

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.