Trait predicates::prelude::PredicateFileContentExt [−][src]
pub trait PredicateFileContentExt where
Self: Predicate<[u8]>,
Self: Sized, { fn from_file_path(self) -> FileContentPredicate<Self> { ... } }
Predicate
extension adapting a slice
Predicate.
Provided methods
fn from_file_path(self) -> FileContentPredicate<Self>
[src]
Returns a FileContentPredicate
that adapts Self
to a file content Predicate
.
Examples
use predicates::prelude::*; use std::path::Path; let predicate_fn = predicate::str::is_empty().not().from_utf8().from_file_path(); assert_eq!(true, predicate_fn.eval(Path::new("./tests/hello_world"))); assert_eq!(false, predicate_fn.eval(Path::new("./tests/empty_file")));