Skip to main content

Escape

Enum Escape 

Source
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.

Implementations§

Source§

impl Escape

Source

pub const fn gate(&self) -> Option<&Path>

The gate this posture spends, and None for the one that has none.

Source

pub const fn refuses(&self) -> bool

Whether the door this posture builds can REFUSE a word — the ONE question every fork in the emission asks, and the reason the three postures are a type rather than two booleans.

Trait Implementations§

Source§

impl Clone for Escape

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Escape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.