1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Recoverable transitions between proof-bearing domain owners.
//!
//! A refinement consumes a value that already proves one invariant layer and
//! attempts to establish the next layer. Failure returns both the unchanged
//! lower-layer owner and the typed rejection reason so callers can inspect the
//! diagnostic, change repair policy, and retry without cloning canonical state.
/// A failed proof refinement together with the still-valid lower-layer owner.
///
/// `T` is the domain value accepted by the attempted transition and `E` is the
/// typed reason that the stronger proof could not be established. The owner is
/// intentionally private so callers cannot accidentally separate it from the
/// failure without choosing one of the consuming accessors. It is boxed inside
/// the error so the common successful `Result` path remains compact; refinement
/// failure pays the allocation while recovery still moves the original owner.
///
/// # Examples
///
/// ```rust
/// use delaunay::refinement::RefinementError;
///
/// let failure = RefinementError::new(3_u8, "not strong enough");
/// assert_eq!(*failure.owner(), 3);
/// assert_eq!(failure.reason(), &"not strong enough");
/// assert_eq!(failure.into_parts(), (3, "not strong enough"));
/// ```