Skip to main content

Laned

Trait Laned 

Source
pub trait Laned:
    Sized
    + Sealed
    + Error
    + Send
    + Sync
    + 'static {
    type WithoutTransient: Error + Send + Sync + 'static;

    // Required methods
    fn lane(&self) -> Lane;
    fn level(&self) -> Level;
    fn narrow_transient(self, attempts: u32) -> Self::WithoutTransient;
    fn message(&self) -> String;

    // Provided methods
    fn is_transient(&self) -> bool { ... }
    fn is_fatal(&self) -> bool { ... }
    fn is_denied(&self) -> bool { ... }
}
Expand description

Sealed. The thing retry/record need from any error they are handed: its lane, and how to narrow it. Implemented by Fail<D, L>, by Fault<L> — the two shapes a generated repo op can return — and by every Carrier whose built-in is Laned.

Required Associated Types§

Required Methods§

Source

fn lane(&self) -> Lane

Source

fn level(&self) -> Level

The operator level of this failure: the lane’s default (Lane::level), overridden only by a Rejected outcome’s Rejection::level.

Source

fn narrow_transient(self, attempts: u32) -> Self::WithoutTransient

Source

fn message(&self) -> String

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

Provided Methods§

Source

fn is_transient(&self) -> bool

Source

fn is_fatal(&self) -> bool

Source

fn is_denied(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C> Laned for C
where C: Carrier, <C as Carrier>::Repr: Laned, <C as IntoLanes>::Rejected: LaneRejected,

A carrier is Laned exactly when its built-in is, and narrows through it. Disjoint from the two built-in impls above: Fault / Fail are not carriers, and downstream cannot implement Carrier for them (orphan rule).

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.

Source§

impl<L> Laned for Fault<L>
where L: LaneProfile, <L as LaneProfile>::Transient: NarrowTransient<<L as LaneProfile>::Fatal>,