pub trait PredicateEnv {
// Required methods
fn platform(&self) -> Platform;
fn env(&self, var: &str) -> Option<String>;
fn command_exists(&self, name: &str) -> bool;
fn file_exists(&self, path: &Path) -> bool;
fn resolver(&self) -> &Resolver;
}Expand description
Environment abstraction used by the predicate evaluator.
Implement this trait to control what the evaluator sees. The default
production implementation is DefaultPredicateEnv; a mock suitable for
unit tests is MockPredicateEnv.
Required Methods§
Sourcefn platform(&self) -> Platform
fn platform(&self) -> Platform
The platform to match platform:linux / platform:macos /
platform:windows against.
Sourcefn env(&self, var: &str) -> Option<String>
fn env(&self, var: &str) -> Option<String>
Look up an environment variable. Returns None when the variable is
not set (as opposed to set-but-empty, which returns Some("")).
Sourcefn command_exists(&self, name: &str) -> bool
fn command_exists(&self, name: &str) -> bool
Returns true when name is found on PATH.
Sourcefn file_exists(&self, path: &Path) -> bool
fn file_exists(&self, path: &Path) -> bool
Returns true when path exists on the filesystem.