Struct frunk::traits::Poly [−][src]
pub struct Poly<T>(pub T);
Expand description
Wrapper type around a function for polymorphic maps and folds.
This is a thin generic wrapper type that is used to differentiate
between single-typed generic closures F
that implements, say, Fn(i8) -> bool
,
and a Poly-typed F
that implements multiple Function types
via the Func
trait. (say, Func<i8, Output=bool>
and Func<bool, Output=f32>
)
This is needed because there are completely generic impls for many of the HList traits that take a simple unwrapped closure.
Trait Implementations
impl<P, R, CH, CTail> CoproductFoldable<Poly<P>, R> for Coproduct<CH, CTail> where
P: Func<CH, Output = R>,
CTail: CoproductFoldable<Poly<P>, R>,
impl<P, R, CH, CTail> CoproductFoldable<Poly<P>, R> for Coproduct<CH, CTail> where
P: Func<CH, Output = R>,
CTail: CoproductFoldable<Poly<P>, R>,
impl<P, R, H, Tail, Acc> HFoldLeftable<Poly<P>, Acc> for HCons<H, Tail> where
P: Func<(Acc, H), Output = R>,
Tail: HFoldLeftable<Poly<P>, R>,
impl<P, R, H, Tail, Acc> HFoldLeftable<Poly<P>, Acc> for HCons<H, Tail> where
P: Func<(Acc, H), Output = R>,
Tail: HFoldLeftable<Poly<P>, R>,
impl<P, R, H, Tail, Init> HFoldRightable<Poly<P>, Init> for HCons<H, Tail> where
P: Func<(<Tail as HFoldRightable<Poly<P>, Init>>::Output, H), Output = R>,
Tail: HFoldRightable<Poly<P>, Init>,
impl<P, R, H, Tail, Init> HFoldRightable<Poly<P>, Init> for HCons<H, Tail> where
P: Func<(<Tail as HFoldRightable<Poly<P>, Init>>::Output, H), Output = R>,
Tail: HFoldRightable<Poly<P>, Init>,
Auto Trait Implementations
impl<T> RefUnwindSafe for Poly<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Poly<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more