[][src]Struct superfusion::criteria::Composite

pub struct Composite {
    pub criteria: Vec<Criteria>,
}

A composition of multiple criteria. All criteria must be satisfied to pass the test.

This is useful for declaring a format that your project can take but it is not necessary to implement.

let composite = Composite::new()
    .with(|path| path.ends_with("test.txt"));

let should_pass = composite.check("data/test.txt");
assert!(should_pass);

let should_fail = !composite.check("data/test/functions");
assert!(should_fail);

Fields

criteria: Vec<Criteria>

Implementations

impl Composite[src]

pub fn new() -> Self[src]

pub fn with<F>(self, criteria: F) -> Self where
    F: Fn(&Path) -> bool + 'static, 
[src]

Insert a criteria into this composite

let composite = Composite::new()
    .with(|path| path.ends_with("txt"))
    .with(|path| path.is_file());

assert_eq!(composite.len(), 2);

pub fn check<P: AsRef<Path>>(&self, root: P) -> bool[src]

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

Trait Implementations

impl Debug for Composite[src]

impl Default for Composite[src]

Auto Trait Implementations

impl !RefUnwindSafe for Composite

impl !Send for Composite

impl !Sync for Composite

impl Unpin for Composite

impl !UnwindSafe for Composite

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<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.