Struct frunk::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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Use functions to fold a coproduct into a single value. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Apply a function to each element of an HList. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the indexed conversion.
Consumes the current HList and returns an HList with the requested shape. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.