Trait mockall::PredicateFileContentExt

source ·
pub trait PredicateFileContentExt: Predicate<[u8]> + Sized {
    // Provided method
    fn from_file_path(self) -> FileContentPredicate<Self> { ... }
}
Expand description

Predicate extension adapting a slice Predicate.

Provided Methods§

source

fn from_file_path(self) -> FileContentPredicate<Self>

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")));

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<P> PredicateFileContentExt for P
where P: Predicate<[u8]>,