pub enum Fail<D, L = Profile<true, true, true>>where
L: LaneProfile,{
Rejected(D),
Denied(<L as LaneProfile>::Denied),
Transient(<L as LaneProfile>::Transient),
Fatal(<L as LaneProfile>::Fatal),
}Expand description
The generic view over a domain rejection D, before retries have run.
Display discipline: Display’s Rejected arm keeps
its rejected: {d} prefix for logs, but no boundary may build a
user-facing message from to_string() — a rejection’s message may embed
caller-supplied input. Use as_rejected and
Rejection::code instead: record_fail keys error.code off the code,
never the message, and a GraphQL boundary should do the same for its error
extension.
Variants§
Rejected(D)
Denied(<L as LaneProfile>::Denied)
Transient(<L as LaneProfile>::Transient)
Fatal(<L as LaneProfile>::Fatal)
Implementations§
Source§impl<D, L> Fail<D, L>where
L: LaneProfile,
impl<D, L> Fail<D, L>where
L: LaneProfile,
Source§impl<D, L> Fail<D, L>where
L: LaneProfile<Denied = Denied>,
impl<D, L> Fail<D, L>where
L: LaneProfile<Denied = Denied>,
Source§impl<D, L> Fail<D, L>where
L: LaneProfile<Transient = Transient>,
impl<D, L> Fail<D, L>where
L: LaneProfile<Transient = Transient>,
pub fn as_transient(&self) -> Option<&Transient>
pub fn is_congestion(&self) -> bool
Sourcepub fn is_contention(&self) -> bool
pub fn is_contention(&self) -> bool
Source§impl<D, L> Fail<D, L>where
L: LaneProfile<Fatal = Fatal>,
impl<D, L> Fail<D, L>where
L: LaneProfile<Fatal = Fatal>,
Source§impl<D, L> Fail<D, L>where
L: LaneProfile,
impl<D, L> Fail<D, L>where
L: LaneProfile,
pub fn lane(&self) -> Lane
Sourcepub fn lift<P, M>(self) -> Fail<P, M>where
P: Lift<D>,
M: LaneProfile,
<L as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<L as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<L as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
<P as Lift<D>>::Unmapped: UnmappedInto<<M as LaneProfile>::Fatal>,
pub fn lift<P, M>(self) -> Fail<P, M>where
P: Lift<D>,
M: LaneProfile,
<L as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<L as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<L as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
<P as Lift<D>>::Unmapped: UnmappedInto<<M as LaneProfile>::Fatal>,
Lift the rejection and, when requested, expand the lane profile without
changing any fault classification. The value-level form of
ResultExt::lift, with
the same single rule: P: Lift<D> is satisfied by a total From<D>
(through errlanes’ blanket, Unmapped = Infallible) and by a partial
#[lift(Source, unhandled = fatal)] mapping (Unmapped = Source),
whose unmapped cases demote to Fatal(Invariant) with the rejection
as their source — which is why a partial mapping requires the
destination to admit Fatal. The strict/partial choice is declared
once on the destination enum; the call site does not repeat it.
pub fn lift_with<P, M>(
self,
f: impl FnOnce(D) -> Result<P, Fatal>,
) -> Fail<P, M>where
M: LaneProfile<Fatal = Fatal>,
<L as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<L as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<L as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
pub fn map_rejected<D2>(self, f: impl FnOnce(D) -> D2) -> Fail<D2, L>
Sourcepub fn rejected(self) -> Result<D, Fault<L>>
pub fn rejected(self) -> Result<D, Fault<L>>
Narrows to the domain outcome, or the non-domain fault. let d = e.rejected()?; propagates the fault into any enclosing Fail<_, L> (or
a Carrier) via the blanket From<Fault<L>>.
pub fn as_rejected(&self) -> Option<&D>
pub fn is_transient(&self) -> bool
pub fn is_fatal(&self) -> bool
pub fn is_denied(&self) -> bool
Sourcepub fn message(&self) -> Stringwhere
D: Rejection,
pub fn message(&self) -> Stringwhere
D: Rejection,
The operator-safe one-line text for this failure — exactly what
record writes to exception.message, for a boundary that must
persist it rather than (or as well as) record it. Transient/
Fatal: the whole source() chain joined with ": ". Denied: its
Display. Rejected: the rejection’s code, never its message
(display discipline — a rejection’s message may embed caller-supplied
input).
Sourcepub fn narrow_transient(
self,
attempts: u32,
) -> Fail<D, <L as LaneProfile>::WithoutTransient>
pub fn narrow_transient( self, attempts: u32, ) -> Fail<D, <L as LaneProfile>::WithoutTransient>
Consumes the Transient lane, yielding the same rejection over L
with its transient slot disabled. An exhausted transient becomes
Fatal(Exhausted), carrying attempts and the last transient as its
source.
Sourcepub fn narrow_denied(self) -> Fail<D, <L as LaneProfile>::WithoutDenied>
pub fn narrow_denied(self) -> Fail<D, <L as LaneProfile>::WithoutDenied>
Narrows away the Denied lane: a denial at a boundary with no
subject (code running as the system) becomes Fatal(Denied) with
the Denied as its source.
Sourcepub fn narrow_rejected(self) -> Fault<L>
pub fn narrow_rejected(self) -> Fault<L>
Narrows away the Rejected lane: a rejection at a boundary with no
caller to correct it is an invariant violation, and becomes
Fatal(Invariant) with the rejection as its source — the same rule
a partial #[lift(.., unhandled = fatal)] applies. Nothing is left
to reject, so the result is a Fault. with_opaque_source: d’s
Display may embed caller-supplied input (the same display
discipline Rejection documents everywhere else), so source()
still returns it for a handler or test to downcast_ref, but
message_chain must not walk into it.
Trait Implementations§
Source§impl<D, L> Clone for Fail<D, L>where
D: Clone,
L: Clone + LaneProfile,
<L as LaneProfile>::Denied: Clone,
<L as LaneProfile>::Transient: Clone,
<L as LaneProfile>::Fatal: Clone,
impl<D, L> Clone for Fail<D, L>where
D: Clone,
L: Clone + LaneProfile,
<L as LaneProfile>::Denied: Clone,
<L as LaneProfile>::Transient: Clone,
<L as LaneProfile>::Fatal: Clone,
Source§impl<D, L> Debug for Fail<D, L>where
D: Debug,
L: Debug + LaneProfile,
<L as LaneProfile>::Denied: Debug,
<L as LaneProfile>::Transient: Debug,
<L as LaneProfile>::Fatal: Debug,
impl<D, L> Debug for Fail<D, L>where
D: Debug,
L: Debug + LaneProfile,
<L as LaneProfile>::Denied: Debug,
<L as LaneProfile>::Transient: Debug,
<L as LaneProfile>::Fatal: Debug,
Source§impl<D, L> Error for Fail<D, L>where
D: Error + 'static,
L: LaneProfile,
impl<D, L> Error for Fail<D, L>where
D: Error + 'static,
L: LaneProfile,
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<W, D, M> From<W> for Fail<D, M>where
W: IntoLanes,
D: Lift<<W as IntoLanes>::Rejected, Unmapped = !>,
M: LaneProfile,
<W as IntoLanes>::Shape: IntoFail,
<<W as IntoLanes>::Lanes as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<<W as IntoLanes>::Lanes as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<<W as IntoLanes>::Lanes as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
? into a Fail: the rejected part must be absorbed totally by D;
a partial conversion needs .lift()?. The source’s
lanes must fit the destination’s profile.
impl<W, D, M> From<W> for Fail<D, M>where
W: IntoLanes,
D: Lift<<W as IntoLanes>::Rejected, Unmapped = !>,
M: LaneProfile,
<W as IntoLanes>::Shape: IntoFail,
<<W as IntoLanes>::Lanes as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<<W as IntoLanes>::Lanes as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<<W as IntoLanes>::Lanes as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
? into a Fail: the rejected part must be absorbed totally by D;
a partial conversion needs .lift()?. The source’s
lanes must fit the destination’s profile.
Source§impl<D, L> Laned for Fail<D, L>where
D: Rejection,
L: LaneProfile,
<L as LaneProfile>::Transient: NarrowTransient<<L as LaneProfile>::Fatal>,
Note the NarrowTransient bound: a profile that admits Transient but
not Fatal is not Laned, so retry cannot be handed one. Retrying an
operation that claims it can never fail permanently is exactly the
contradiction the bound rules out.
impl<D, L> Laned for Fail<D, L>where
D: Rejection,
L: LaneProfile,
<L as LaneProfile>::Transient: NarrowTransient<<L as LaneProfile>::Fatal>,
Note the NarrowTransient bound: a profile that admits Transient but
not Fatal is not Laned, so retry cannot be handed one. Retrying an
operation that claims it can never fail permanently is exactly the
contradiction the bound rules out.
type WithoutTransient = Fail<D, <L as LaneProfile>::WithoutTransient>
fn lane(&self) -> Lane
Source§fn level(&self) -> Level
fn level(&self) -> Level
Lane::level), overridden only by a Rejected outcome’s
Rejection::level.fn narrow_transient( self, attempts: u32, ) -> <Fail<D, L> as Laned>::WithoutTransient
Source§fn message(&self) -> String
fn message(&self) -> String
record writes to exception.message, for a boundary that must
persist it rather than (or as well as) record it. Transient/
Fatal: the whole source() chain joined with ": ". Denied: its
Display. Rejected: the rejection’s code, never its message
(display discipline — a rejection’s message may embed caller-supplied
input).fn is_transient(&self) -> bool
fn is_fatal(&self) -> bool
fn is_denied(&self) -> bool
impl<D, L> Repr for Fail<D, L>where
L: LaneProfile,
Source§impl<D, L> Reshape for Fail<D, L>where
L: LaneProfile,
impl<D, L> Reshape for Fail<D, L>where
L: LaneProfile,
type WithDenied = Fail<D, <L as LaneProfile>::WithDenied>
type WithoutDenied = Fail<D, <L as LaneProfile>::WithoutDenied>
type WithTransient = Fail<D, <L as LaneProfile>::WithTransient>
type WithoutTransient = Fail<D, <L as LaneProfile>::WithoutTransient>
type WithFatal = Fail<D, <L as LaneProfile>::WithFatal>
Auto Trait Implementations§
impl<D, L> Freeze for Fail<D, L>where
D: Freeze,
<L as LaneProfile>::Denied: Freeze,
<L as LaneProfile>::Transient: Freeze,
<L as LaneProfile>::Fatal: Freeze,
impl<D, L> RefUnwindSafe for Fail<D, L>where
D: RefUnwindSafe,
<L as LaneProfile>::Denied: RefUnwindSafe,
<L as LaneProfile>::Transient: RefUnwindSafe,
<L as LaneProfile>::Fatal: RefUnwindSafe,
impl<D, L> Send for Fail<D, L>where
D: Send,
<L as LaneProfile>::Denied: Send,
<L as LaneProfile>::Transient: Send,
<L as LaneProfile>::Fatal: Send,
impl<D, L> Sync for Fail<D, L>where
D: Sync,
<L as LaneProfile>::Denied: Sync,
<L as LaneProfile>::Transient: Sync,
<L as LaneProfile>::Fatal: Sync,
impl<D, L> Unpin for Fail<D, L>where
D: Unpin,
<L as LaneProfile>::Denied: Unpin,
<L as LaneProfile>::Transient: Unpin,
<L as LaneProfile>::Fatal: Unpin,
impl<D, L> UnsafeUnpin for Fail<D, L>where
D: UnsafeUnpin,
<L as LaneProfile>::Denied: UnsafeUnpin,
<L as LaneProfile>::Transient: UnsafeUnpin,
<L as LaneProfile>::Fatal: UnsafeUnpin,
impl<D, L> UnwindSafe for Fail<D, L>where
D: UnwindSafe,
<L as LaneProfile>::Denied: UnwindSafe,
<L as LaneProfile>::Transient: UnwindSafe,
<L as LaneProfile>::Fatal: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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