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>
impl<P, R, CH, CTail> CoproductFoldable<Poly<P>, R> for Coproduct<CH, CTail>
source§impl<'a, P, CH, CTail> CoproductMappable<&'a Poly<P>> for Coproduct<CH, CTail>
impl<'a, P, CH, CTail> CoproductMappable<&'a Poly<P>> for Coproduct<CH, CTail>
Implementation for mapping a Coproduct using a &poly_fn!
.
source§impl<'a, P, CH, CTail> CoproductMappable<&'a mut Poly<P>> for Coproduct<CH, CTail>
impl<'a, P, CH, CTail> CoproductMappable<&'a mut Poly<P>> for Coproduct<CH, CTail>
Implementation for mapping a Coproduct using a &mut poly_fn!
.
source§impl<P, CH, CTail> CoproductMappable<Poly<P>> for Coproduct<CH, CTail>
impl<P, CH, CTail> CoproductMappable<Poly<P>> for Coproduct<CH, CTail>
Implementation for mapping a Coproduct using a poly_fn!
.
source§impl<P, R, H, Tail, Acc> HFoldLeftable<Poly<P>, Acc> for HCons<H, Tail>
impl<P, R, H, Tail, Acc> HFoldLeftable<Poly<P>, Acc> for HCons<H, Tail>
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>,
impl<T: Copy> Copy for Poly<T>
Auto Trait Implementations§
impl<T> Freeze for Poly<T>where
T: Freeze,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)