Skip to main content

Lift

Trait Lift 

Source
pub trait Lift<X>: Sized {
    type Unmapped;

    // Required method
    fn lift(x: X) -> Result<Self, Self::Unmapped>;
}
Expand description

Consuming mapping. #[derive(Lift)] with #[lift(Source)] generates an exhaustive mapping with Unmapped = Infallible and a total From<Source> conversion. #[lift(Source, unhandled = fatal)] returns the original unmapped source; Fail::widen wraps it as a fatal invariant with its source intact. The derive does not require or implement Rejection. Derive Rejection separately to provide codes and levels; simple lift mappings forward that metadata by default unless the destination declares its own.

Required Associated Types§

Required Methods§

Source

fn lift(x: X) -> Result<Self, Self::Unmapped>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<P> Lift<!> for P

Every destination lifts an Infallible rejected slot trivially — this is what lets a fault-only crate::Classify wrapper satisfy the Fail blanket for any D, with no Lift/From declared at all.

Source§

impl<X, P> Lift<X> for P
where X: Rejection, P: From<X>,

A total From counts as a strict lift, so one call-site method can require only Lift and still cover both mapping modes. Bounded to X: Rejection (rather than any X) so it does not overlap the Lift<Infallible> blanket below — both are needed, since a crate::Classify wrapper’s rejected slot is either a Rejection or Infallible (never anything else, by RejectedSlot’s own two impls).