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<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
See [TransientKind::is_contention].
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 widen<P, M>(self) -> Fail<P, M>where
P: From<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>,
pub fn widen<P, M>(self) -> Fail<P, M>where
P: From<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>,
Widen rejection and lane profile without changing any classification.
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>,
Explicit partial mapping. Unmapped values retain their source as invariants.
pub fn widen_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 Failure 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<D, L> Failure for Fail<D, L>where
D: Rejection,
L: LaneProfile,
impl<D, L> Failure for Fail<D, L>where
D: Rejection,
L: LaneProfile,
type Rejection = D
type Lanes = L
fn into_fail( self, ) -> Fail<<Fail<D, L> as Failure>::Rejection, <Fail<D, L> as Failure>::Lanes>
fn from_fail( f: Fail<<Fail<D, L> as Failure>::Rejection, <Fail<D, L> as Failure>::Lanes>, ) -> Fail<D, L>
fn as_fail( &self, ) -> &Fail<<Fail<D, L> as Failure>::Rejection, <Fail<D, L> as Failure>::Lanes>
fn lane(&self) -> Lane
fn is_transient(&self) -> bool
Source§impl<D, S, L> From<Fault<S>> for Fail<D, L>where
S: LaneProfile,
L: LaneProfile,
<S as LaneProfile>::Denied: Into<<L as LaneProfile>::Denied>,
<S as LaneProfile>::Transient: Into<<L as LaneProfile>::Transient>,
<S as LaneProfile>::Fatal: Into<<L as LaneProfile>::Fatal>,
The real blanket the Infallible encoding could not have: Fault<L> is not
Fail, so this does not overlap From<T> for T.
impl<D, S, L> From<Fault<S>> for Fail<D, L>where
S: LaneProfile,
L: LaneProfile,
<S as LaneProfile>::Denied: Into<<L as LaneProfile>::Denied>,
<S as LaneProfile>::Transient: Into<<L as LaneProfile>::Transient>,
<S as LaneProfile>::Fatal: Into<<L as LaneProfile>::Fatal>,
The real blanket the Infallible encoding could not have: Fault<L> is not
Fail, so this does not overlap From<T> for T.
Source§impl<W, D, M> From<W> for Fail<D, M>where
W: Classify,
D: Lift<<W as Classify>::Rejected, Unmapped = !>,
M: LaneProfile,
<<W as Classify>::Lanes as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<<W as Classify>::Lanes as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<<W as Classify>::Lanes as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
? into a Fail: the rejected part must be absorbed totally by D (no
decision left for the call site to make with .widen()); the wrapper’s
lanes must fit the destination’s profile. Replaces the narrower
impl<C: Rejection, D: From<C>, L> From<C> for Fail<D, L> — a bare
rejection is the W::Rejected = W, W::Lanes = NoLanes case of this.
impl<W, D, M> From<W> for Fail<D, M>where
W: Classify,
D: Lift<<W as Classify>::Rejected, Unmapped = !>,
M: LaneProfile,
<<W as Classify>::Lanes as LaneProfile>::Denied: Into<<M as LaneProfile>::Denied>,
<<W as Classify>::Lanes as LaneProfile>::Transient: Into<<M as LaneProfile>::Transient>,
<<W as Classify>::Lanes as LaneProfile>::Fatal: Into<<M as LaneProfile>::Fatal>,
? into a Fail: the rejected part must be absorbed totally by D (no
decision left for the call site to make with .widen()); the wrapper’s
lanes must fit the destination’s profile. Replaces the narrower
impl<C: Rejection, D: From<C>, L> From<C> for Fail<D, L> — a bare
rejection is the W::Rejected = W, W::Lanes = NoLanes case of this.
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 moreSource§impl<F> Laned for Fwhere
F: Failure,
<<F as Failure>::Lanes as LaneProfile>::Transient: NarrowTransient<<<F as Failure>::Lanes as LaneProfile>::Fatal>,
impl<F> Laned for Fwhere
F: Failure,
<<F as Failure>::Lanes as LaneProfile>::Transient: NarrowTransient<<<F as Failure>::Lanes as LaneProfile>::Fatal>,
type WithoutTransient = Fail<<F as Failure>::Rejection, <<F as Failure>::Lanes as LaneProfile>::WithoutTransient>
fn lane(&self) -> Lane
fn narrow_transient(self, attempts: u32) -> <F 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).