axiolid_heal/
traits.rs

1//! Open diagnosis and repair extension points.
2
3use axiolid_core::Tolerance;
4
5use crate::{Diagnosis, RepairPlan, RepairReport};
6
7/// Diagnose without mutating input.
8pub trait Diagnose<T>: core::fmt::Debug + Send + Sync {
9    /// Structured failure to complete diagnosis.
10    type Error: std::error::Error + Send + Sync + 'static;
11
12    /// Inspect one value.
13    fn diagnose(&self, value: &T, tolerance: Tolerance) -> Result<Diagnosis, Self::Error>;
14}
15
16/// Apply one explicit repair plan and return new geometry plus audit report.
17pub trait Repair<T>: core::fmt::Debug + Send + Sync {
18    /// Structured repair failure.
19    type Error: std::error::Error + Send + Sync + 'static;
20
21    /// Never mutates the caller's source value in place.
22    fn repair(
23        &self,
24        value: &T,
25        plan: &RepairPlan,
26        tolerance: Tolerance,
27    ) -> Result<(T, RepairReport), Self::Error>;
28}