Lines Matching +full:path +full:- +full:exists
1 // Copyright (c) 2018 The predicates-rs Project Developers.
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10 use std::path;
18 /// This is created by the `predicate::path::exists` and `predicate::path::missing`.
21 exists: bool, field
24 impl Predicate<path::Path> for ExistencePredicate {
25 fn eval(&self, path: &path::Path) -> bool { in eval()
26 path.exists() == self.exists in eval()
32 variable: &path::Path, in find_case() argument
33 ) -> Option<reflection::Case<'a>> { in find_case()
46 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { in fmt()
51 palette.description(if self.exists { "exists" } else { "missing" }), in fmt()
57 /// Creates a new `Predicate` that ensures the path exists.
62 /// use std::path::Path;
65 /// let predicate_fn = predicate::path::exists();
66 /// assert_eq!(true, predicate_fn.eval(Path::new("Cargo.toml")));
68 pub fn exists() -> ExistencePredicate { in exists() function
69 ExistencePredicate { exists: true } in exists()
72 /// Creates a new `Predicate` that ensures the path doesn't exist.
77 /// use std::path::Path;
80 /// let predicate_fn = predicate::path::missing();
81 /// assert_eq!(true, predicate_fn.eval(Path::new("non-existent-file.foo")));
83 pub fn missing() -> ExistencePredicate { in missing()
84 ExistencePredicate { exists: false } in missing()