Trait recv_dir::Filter

source ·
pub trait Filter {
    // Required method
    fn filter(&self, base_path: &Path, path_to_visit: &Path) -> bool;

    // Provided methods
    fn and<B>(self, other: B) -> And<Self, B>
       where Self: Sized,
             B: Filter { ... }
    fn or<B>(self, other: B) -> Or<Self, B>
       where Self: Sized,
             B: Filter { ... }
    fn not(self) -> Not<Self>
       where Self: Sized { ... }
}

Required Methods§

source

fn filter(&self, base_path: &Path, path_to_visit: &Path) -> bool

Checks whether path_to_visit should be visited or not. The base_path is the initial directory provided to the visitor.

This filter is called only for directories, if it returns true it means that the directory should be visited, otherwise, it will be skipped.

The directory will be emitted by the iterator regardless of the return value of this function.

Provided Methods§

source

fn and<B>(self, other: B) -> And<Self, B>where Self: Sized, B: Filter,

Creates a filter that only accepts both this and the other condition.

source

fn or<B>(self, other: B) -> Or<Self, B>where Self: Sized, B: Filter,

Creates a filter that accepts this or the other condition.

source

fn not(self) -> Not<Self>where Self: Sized,

Creates a filter that negates when this filter accepts.

Implementors§

source§

impl Filter for Accept

source§

impl Filter for MaxDepth

source§

impl<A> Filter for This<A>where A: Filter,

source§

impl<F> Filter for Closure<F>where F: Fn(&Path, &Path) -> bool,