pub struct PolicyEngine;Expand description
Evaluates declarative policy rules against workspace state (Req 11.1–11.7).
Implementations§
Source§impl PolicyEngine
impl PolicyEngine
Sourcepub fn evaluate(
config: &PolicyConfig,
workspace: &ResolvedWorkspace,
installed: &[InstalledAsset],
catalog: &CatalogStore,
now_date: &str,
) -> PolicyEvaluation
pub fn evaluate( config: &PolicyConfig, workspace: &ResolvedWorkspace, installed: &[InstalledAsset], catalog: &CatalogStore, now_date: &str, ) -> PolicyEvaluation
Evaluate all rules in config against workspace / installed / catalog.
Only rules whose scope matches the workspace and that are not suppressed contribute to the result. Deterministic: same inputs → identical output (Req 11.3).
Sourcepub fn rule_applies(rule: &PolicyRule, workspace: &ResolvedWorkspace) -> bool
pub fn rule_applies(rule: &PolicyRule, workspace: &ResolvedWorkspace) -> bool
Return true when rule.scope matches workspace (Req 11.6).
Sourcepub fn is_suppressed(
rule: &PolicyRule,
workspace: &ResolvedWorkspace,
config: &PolicyConfig,
now_date: &str,
) -> bool
pub fn is_suppressed( rule: &PolicyRule, workspace: &ResolvedWorkspace, config: &PolicyConfig, now_date: &str, ) -> bool
Return true when a suppression covers rule for workspace and has
not expired as of now_date (YYYY-MM-DD, Req 15.6).
Lexicographic comparison is safe for ISO dates in this format.
Sourcepub fn compliance_score(passed: usize, total: usize) -> f64
pub fn compliance_score(passed: usize, total: usize) -> f64
Compute compliance score: (passed / total) * 100, rounded half-up to
1 decimal place (Req 15.3). Returns 100.0 when total == 0.
Auto Trait Implementations§
impl Freeze for PolicyEngine
impl RefUnwindSafe for PolicyEngine
impl Send for PolicyEngine
impl Sync for PolicyEngine
impl Unpin for PolicyEngine
impl UnsafeUnpin for PolicyEngine
impl UnwindSafe for PolicyEngine
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> 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> ⓘ
Converts
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> ⓘ
Converts
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