pub trait LiftFrom<T, I> {
// Required method
fn lift_from(part: T) -> Self;
}
Expand description
Indexed type conversions of T -> Self
with index I
.
This is a generalized version of From
which for example allows the caller
to use default values for parts of Self
and thus “fill in the blanks”.
LiftFrom
is the reciprocal of LiftInto
.
use frunk::lift_from;
use frunk::prelude::*;
use frunk_core::{HList, hlist};
type H = HList![(), usize, f64, (), bool];
let x = H::lift_from(42.0);
assert_eq!(x, hlist![(), 0, 42.0, (), false]);
let x: H = lift_from(true);
assert_eq!(x, hlist![(), 0, 0.0, (), true]);
RunRequired Methods§
Object Safety§
This trait is not object safe.