refactor(core): trim policy result API
This commit is contained in:
@@ -51,15 +51,6 @@ pub struct EvaluationContext<'a> {
|
||||
pub candidate: Candidate<'a>,
|
||||
}
|
||||
|
||||
/// A rule's result before the pipeline reduces all results to one verdict.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum RuleOutcome {
|
||||
Pass,
|
||||
Unknown,
|
||||
SoftFail,
|
||||
HardFail,
|
||||
}
|
||||
|
||||
/// A rule's identity when no violation exists to carry concrete evidence.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum RuleKind {
|
||||
@@ -81,19 +72,6 @@ pub enum RuleEvaluation {
|
||||
HardFail(Rule),
|
||||
}
|
||||
|
||||
impl RuleEvaluation {
|
||||
/// The outcome category used by verdict reduction.
|
||||
#[must_use]
|
||||
pub const fn outcome(&self) -> RuleOutcome {
|
||||
match self {
|
||||
Self::Pass(_) => RuleOutcome::Pass,
|
||||
Self::Unknown(_) => RuleOutcome::Unknown,
|
||||
Self::SoftFail(_) => RuleOutcome::SoftFail,
|
||||
Self::HardFail(_) => RuleOutcome::HardFail,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A policy rule that can participate in the verdict pipeline.
|
||||
pub trait PolicyRule: std::fmt::Debug {
|
||||
fn evaluate(&self, context: &EvaluationContext<'_>) -> RuleEvaluation;
|
||||
|
||||
Reference in New Issue
Block a user