pub struct ConstraintAnalyzer { /* private fields */ }Expand description
ConstraintAnalyzer — enforces constraint_violation (heuristic, Warning).
Strategy: the user declares invariants in spec-drift.toml as
[[rules.constraint_violation]] entries. The only shape supported today
is a return-type constraint:
[[rules.constraint_violation]]
name = "handlers_return_api_result"
glob = "src/handlers/**"
return_type = "Result<_, ApiError>"For every fn under glob, the analyzer compares the function’s return
type to return_type. Matching is syntactic: whitespace is normalized and
_ in the pattern matches any single tokenized segment. This keeps the
rule deterministic without requiring full type resolution.
Implementations§
Source§impl ConstraintAnalyzer
impl ConstraintAnalyzer
pub fn new(rules: Vec<ConstraintRule>) -> Self
Trait Implementations§
Source§impl DriftAnalyzer for ConstraintAnalyzer
impl DriftAnalyzer for ConstraintAnalyzer
fn analyze(&self, ctx: &ProjectContext) -> Vec<Divergence>
Auto Trait Implementations§
impl Freeze for ConstraintAnalyzer
impl RefUnwindSafe for ConstraintAnalyzer
impl Send for ConstraintAnalyzer
impl Sync for ConstraintAnalyzer
impl Unpin for ConstraintAnalyzer
impl UnsafeUnpin for ConstraintAnalyzer
impl UnwindSafe for ConstraintAnalyzer
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> 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