pub struct Universal<'a> {
pub deployment: DeploymentAttributes<'a>,
pub now: OffsetDateTime,
}Expand description
Facts that do not belong to the account or the write, but that a
stateless predicate is still allowed to reference — grouped into one
field per Subject variant rather than left flat, since the field
list otherwise grows by one every time a new universal fact is added.
§Why now lives here instead of an evaluator calling a clock
Time is an input, never an ambient read: nothing in this crate lets an
evaluator call SystemTime::now() or its equivalent, for the same
reason evaluate takes no store
handle — a capability not reachable from the arguments cannot be reached
at all. Passing now explicitly instead means:
- An evaluator implementing a time-shaped rule stays a pure function of
its inputs, testable by constructing a
Subjectwith the instant a test wants, never by sleeping or mocking a global clock. - The instant a decision used is exactly what was passed in, so the
write path can record it in the evaluation log.
plan/policy.mdalready says decisions are not reproducible and the log records the decision rather than re-deriving it; a time-dependent rule is a second, independent reason that holds, and the recorded instant is what makes such a decision explicable later.
Fields§
§deployment: DeploymentAttributes<'a>Facts about this deployment. See DeploymentAttributes.
now: OffsetDateTimeThe instant this subject is being evaluated at, supplied by the caller rather than read from a clock inside an evaluator.
Trait Implementations§
Source§impl<'a> PartialEq for Universal<'a>
impl<'a> PartialEq for Universal<'a>
impl<'a> Copy for Universal<'a>
impl<'a> Eq for Universal<'a>
impl<'a> StructuralPartialEq for Universal<'a>
Auto Trait Implementations§
impl<'a> Freeze for Universal<'a>
impl<'a> RefUnwindSafe for Universal<'a>
impl<'a> Send for Universal<'a>
impl<'a> Sync for Universal<'a>
impl<'a> Unpin for Universal<'a>
impl<'a> UnsafeUnpin for Universal<'a>
impl<'a> UnwindSafe for Universal<'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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.