pub struct WhenEnv<'a> {
pub facts: &'a FactValues,
pub vars: &'a HashMap<String, String>,
pub iter: Option<IterEnv<'a>>,
pub env: Option<&'a HashMap<String, String>>,
}Fields§
§facts: &'a FactValues§vars: &'a HashMap<String, String>§iter: Option<IterEnv<'a>>Per-iteration context, populated when this WhenEnv
gates an iterated rule (for_each_dir /
for_each_file / every_matching_has). None for
top-level rule gating, where iter.* references
resolve to falsy / null per the “unknown fact is
falsy” convention.
env: Option<&'a HashMap<String, String>>Optional environment-variable snapshot backing the env.*
namespace. None — the production default — means the
evaluator reads the live process environment via
std::env::var (env is constant during a run, so the
eval-time read matches a load-time snapshot). Tests inject
a fake map via WhenEnv::with_env so they never touch
the real environment (Rust 2024 marks set_var unsafe).
Implementations§
Source§impl<'a> WhenEnv<'a>
impl<'a> WhenEnv<'a>
Sourcepub fn new(facts: &'a FactValues, vars: &'a HashMap<String, String>) -> Self
pub fn new(facts: &'a FactValues, vars: &'a HashMap<String, String>) -> Self
Construct a WhenEnv without iteration context — the
shape every existing call site uses. iter.* references
in the expression resolve to null / false; env.* reads
the live process environment.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for WhenEnv<'a>
impl<'a> RefUnwindSafe for WhenEnv<'a>
impl<'a> Send for WhenEnv<'a>
impl<'a> Sync for WhenEnv<'a>
impl<'a> Unpin for WhenEnv<'a>
impl<'a> UnsafeUnpin for WhenEnv<'a>
impl<'a> UnwindSafe for WhenEnv<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more