Struct frunk_core::traits::Poly
source · 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.
Tuple Fields§
§0: T
Trait Implementations§
source§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>,
source§impl<'a, P, CH, CTail> CoproductMappable<&'a Poly<P>> for Coproduct<CH, CTail>where
P: Func<CH>,
CTail: CoproductMappable<&'a Poly<P>>,
impl<'a, P, CH, CTail> CoproductMappable<&'a Poly<P>> for Coproduct<CH, CTail>where P: Func<CH>, CTail: CoproductMappable<&'a Poly<P>>,
Implementation for mapping a Coproduct using a &poly_fn!
.
source§impl<'a, P, CH, CTail> CoproductMappable<&'a mut Poly<P>> for Coproduct<CH, CTail>where
P: Func<CH>,
CTail: CoproductMappable<&'a mut Poly<P>>,
impl<'a, P, CH, CTail> CoproductMappable<&'a mut Poly<P>> for Coproduct<CH, CTail>where P: Func<CH>, CTail: CoproductMappable<&'a mut Poly<P>>,
Implementation for mapping a Coproduct using a &mut poly_fn!
.
source§impl<P, CH, CTail> CoproductMappable<Poly<P>> for Coproduct<CH, CTail>where
P: Func<CH>,
CTail: CoproductMappable<Poly<P>>,
impl<P, CH, CTail> CoproductMappable<Poly<P>> for Coproduct<CH, CTail>where P: Func<CH>, CTail: CoproductMappable<Poly<P>>,
Implementation for mapping a Coproduct using a poly_fn!
.
source§impl<P, R, H, Tail, Acc> HFoldLeftable<Poly<P>, Acc> for HCons<H, Tail>where
Tail: HFoldLeftable<Poly<P>, R>,
P: Func<(Acc, H), Output = R>,
impl<P, R, H, Tail, Acc> HFoldLeftable<Poly<P>, Acc> for HCons<H, Tail>where Tail: HFoldLeftable<Poly<P>, R>, P: Func<(Acc, H), Output = R>,
source§impl<P, R, H, Tail, Init> HFoldRightable<Poly<P>, Init> for HCons<H, Tail>where
Tail: HFoldRightable<Poly<P>, Init>,
P: Func<(<Tail as HFoldRightable<Poly<P>, Init>>::Output, H), Output = R>,
impl<P, R, H, Tail, Init> HFoldRightable<Poly<P>, Init> for HCons<H, Tail>where Tail: HFoldRightable<Poly<P>, Init>, P: Func<(<Tail as HFoldRightable<Poly<P>, Init>>::Output, H), Output = R>,
source§impl<P, H, Tail> HMappable<Poly<P>> for HCons<H, Tail>where
P: Func<H>,
Tail: HMappable<Poly<P>>,
impl<P, H, Tail> HMappable<Poly<P>> for HCons<H, Tail>where P: Func<H>, Tail: HMappable<Poly<P>>,
impl<T: Copy> Copy for Poly<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Poly<T>where T: RefUnwindSafe,
impl<T> Send for Poly<T>where T: Send,
impl<T> Sync for Poly<T>where T: Sync,
impl<T> Unpin for Poly<T>where T: Unpin,
impl<T> UnwindSafe for Poly<T>where T: 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
Mutably borrows from an owned value. Read more