pub enum Escape {
Total,
Gate(Path),
TryGate(Path),
}Expand description
HOW a mirror turns a word its upstream does not name into an upstream value — the three postures
#[ingraph(other)] takes, and the whole of what a mirror’s openness can be.
The escape’s presence says the upstream vocabulary is OPEN. What this says is where that openness LIVES, and the three answers are not interchangeable: one is a fact about the upstream’s type, one is a fact about a function’s signature, and one admits that the door itself can refuse.
§Why there are three, and not one
The first posture was the only one, and a vocabulary census walked into what it cannot express. A
crate whose parse is behaviourally total but whose FromStr::Err is a shared refusal type — one
error type serving a no-alloc tier that really can refuse and an alloc tier that cannot — reads as
CLOSED to a bound on that type, while the same crate hands out a fn other(impl AsRef<str>) -> Self that is total in the only way that matters. Nine types were unmirrorable for that reason
alone. The gate is what lets a declaration point at the totality instead of asking the type
system to find it.
Variants§
Total
Bare #[ingraph(other)] — the UPSTREAM’S OWN parse is total, and its FromStr::Err is where
that is said.
The strongest of the three and the one that needs no gate: the claim is spent as a bound on
<Remote as FromStr>::Err, and the compiler settles it. Nothing about this posture moved when
the other two arrived.
Gate(Path)
#[ingraph(other(from = "…"))] — an UNCONDITIONAL gate, fn(impl AsRef<str>) -> Remote.
The totality is the GATE’S SIGNATURE rather than the upstream’s error type, and the mirror is
as open as a bare other: its FromStr::Err is Infallible and
no refusal type is declared beside the enum. The door parses FIRST and falls to the gate only
on a refusal, so every word the upstream does name still reaches its own variant.
TryGate(Path)
#[ingraph(other(try_from = "…"))] — a gate that can REFUSE, which makes the mirror HALF-OPEN.
Open outward: the From<Remote> arm list still carries the wildcard that absorbs an upstream
value this mirror does not restate. Closed inward: a word neither the upstream’s parse nor the
gate accepts is a refusal, reported as this vocabulary’s own <Enum>ParseError exactly as a
closed mirror reports its upstream’s — which is why error(rename = "…") is legal here and in
neither of the other two.
The gate’s Err must BE <Remote as FromStr>::Err, and that law is what makes the posture
coherent rather than merely permitted: under it the door composes to a function with the same
type as from_str itself, so there is one refusal for the wrapping to name.