Struct frunk_core::traits::Poly
[−]
[src]
pub struct Poly<T>(pub T);
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, H, Tail> HMappable<Poly<P>> for HCons<H, Tail> where
P: Func<H>,
Tail: HMappable<Poly<P>>,
[src]
P: Func<H>,
Tail: HMappable<Poly<P>>,
type Output = HCons<<P as Func<H>>::Output, <Tail as HMappable<Poly<P>>>::Output>
fn map(self, poly: Poly<P>) -> Self::Output
[src]
Apply a function to each element of an HList. Read more
impl<P, R, CH, CTail> CoproductFoldable<Poly<P>, R> for Coproduct<CH, CTail> where
P: Func<CH, Output = R>,
CTail: CoproductFoldable<Poly<P>, R>,
[src]
P: Func<CH, Output = R>,
CTail: CoproductFoldable<Poly<P>, R>,
fn fold(self, f: Poly<P>) -> R
[src]
Use functions to fold a coproduct into a single value. Read more
impl<T: Debug> Debug for Poly<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Copy> Copy for Poly<T>
[src]
impl<T: Clone> Clone for Poly<T>
[src]
fn clone(&self) -> Poly<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more