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
76
77
78
79
80
81
82
83
84
85
86
87
//! [`Refused`] — WHICH LEG of a `fanout` write refused, when one of them did.
use fmt;
/// Which leg of a two-legged fan refused, carrying that leg's own error.
///
/// # Why a fan needs this at all
///
/// A `fanout` field's engines are DIFFERENT ENGINES, so they are different Rust types with different
/// `Error` associated types — and neither is convertible into the other, because
/// [`FulltextEngine::Error`](super::FulltextEngine::Error) and
/// [`VectorEngine::Error`](super::VectorEngine::Error) carry no bound at all. That is deliberate and
/// this crate will not narrow it: *each is an associated type with no bound, and each has a second
/// implementation already in view that would break under the obvious narrowing.* A fan therefore
/// cannot flatten its legs' errors into one type, and must not erase them into a box — boxing is
/// what a bound would have bought, and the bound is the thing being refused.
///
/// So the fan's error is the SUM, and the caller matches on it. Nothing is lost: each leg's error
/// arrives as itself, at its own type, and the variant says which engine produced it.
///
/// # N legs, spelled by nesting
///
/// Two variants serve any arity, right-nested: a three-engine fan reports
/// `Refused<A, Refused<B, C>>`, and the emission writes exactly that. A wider enum per arity would
/// be a family of types that must agree and are free to stop agreeing, which is this crate's reason
/// for every other collapse.
///
/// # The fan is SEQUENTIAL and stops at the first refusal
///
/// A leg that already committed is not rolled back, and there is nothing here that could: the
/// engines are independent stores with no shared transaction, and inventing one would be this crate
/// deciding a durability question that belongs to the deployment. What the caller is owed is
/// knowing WHICH leg refused — so the legs before it committed and the legs after it were not
/// attempted — and that is exactly what this type says.
/// CONDITIONAL, so the sum is an error exactly where its legs are — and the seam stays unbounded.