[−][src]Struct superfusion::criteria::Composite
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]
F: Fn(&Path) -> bool + 'static,
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,