pub struct Outcome { /* private fields */ }Expand description
Immutable, evidence-backed result of evaluating one planned action.
Unknown is canonical: it has zero confidence, no rule identity, and no
evidence. Every other status must identify the winning verifier rule and
carry at least one immutable evidence reference.
§Example
use std::collections::BTreeSet;
use termivar_core::{
EntityId, EvidenceId, Outcome, OutcomeStatus, Probability, VerificationStage,
};
let outcome = Outcome::verified(
"case:sqli:1",
EntityId::new("endpoint:https://example.test")?,
"sqli.verify",
"hypothesis:sqli:1",
"verify.boolean-difference",
VerificationStage::Passive,
OutcomeStatus::Success,
Probability::from_percent(95)?,
"Boolean responses diverged consistently",
BTreeSet::from([EvidenceId::parse("evidence:boolean-difference")?]),
)?;
assert_eq!(outcome.status(), OutcomeStatus::Success);Implementations§
Source§impl Outcome
impl Outcome
Sourcepub fn verified(
case_id: impl Into<String>,
subject: EntityId,
action_id: impl Into<String>,
hypothesis_id: impl Into<String>,
verifier_rule_id: impl Into<String>,
stage: VerificationStage,
status: OutcomeStatus,
confidence: Probability,
rationale: impl Into<String>,
evidence_ids: BTreeSet<EvidenceId>,
) -> Result<Outcome, OutcomeError>
pub fn verified( case_id: impl Into<String>, subject: EntityId, action_id: impl Into<String>, hypothesis_id: impl Into<String>, verifier_rule_id: impl Into<String>, stage: VerificationStage, status: OutcomeStatus, confidence: Probability, rationale: impl Into<String>, evidence_ids: BTreeSet<EvidenceId>, ) -> Result<Outcome, OutcomeError>
Creates an evidence-backed non-unknown outcome.
Sourcepub fn unknown(
case_id: impl Into<String>,
subject: EntityId,
action_id: impl Into<String>,
hypothesis_id: impl Into<String>,
stage: VerificationStage,
rationale: impl Into<String>,
) -> Result<Outcome, OutcomeError>
pub fn unknown( case_id: impl Into<String>, subject: EntityId, action_id: impl Into<String>, hypothesis_id: impl Into<String>, stage: VerificationStage, rationale: impl Into<String>, ) -> Result<Outcome, OutcomeError>
Creates the canonical fallback used when no verifier rule is eligible.
Sourcepub fn hypothesis_id(&self) -> &str
pub fn hypothesis_id(&self) -> &str
Returns the hypothesis associated with this outcome’s case.
The host orchestration contract decides whether a conclusive result may transition this hypothesis.
Sourcepub fn verifier_rule_id(&self) -> Option<&str>
pub fn verifier_rule_id(&self) -> Option<&str>
Returns the winning verifier rule, if one matched.
Sourcepub fn stage(&self) -> VerificationStage
pub fn stage(&self) -> VerificationStage
Returns the evidence collection stage.
Sourcepub fn status(&self) -> OutcomeStatus
pub fn status(&self) -> OutcomeStatus
Returns the final classification.
Sourcepub fn confidence(&self) -> Probability
pub fn confidence(&self) -> Probability
Returns the rule-assigned calibrated confidence.
Sourcepub fn evidence_ids(&self) -> &BTreeSet<EvidenceId>
pub fn evidence_ids(&self) -> &BTreeSet<EvidenceId>
Returns immutable evidence supporting the decision.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Outcome
impl<'de> Deserialize<'de> for Outcome
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Outcome, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Outcome, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for Outcome
Source§impl Serialize for Outcome
impl Serialize for Outcome
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Outcome
Auto Trait Implementations§
impl Freeze for Outcome
impl RefUnwindSafe for Outcome
impl Send for Outcome
impl Sync for Outcome
impl Unpin for Outcome
impl UnsafeUnpin for Outcome
impl UnwindSafe for Outcome
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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
§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
key and return true if they are equal.