Struct naan::fun::compose::Compose

source ·
pub struct Compose<F, G, X> { /* private fields */ }
Expand description

Struct capturing Sized function composition.

Implements F1/F1Once when F and G implement F1/F1Once.

X is the “erased” type returned by F and passed to G, stored as PhantomData to make trait implementation simpler.

For examples, see F1Once::chain.

Implementations§

source§

impl<F, G, X> Compose<F, G, X>

source

pub fn compose<A, B>(f: F, g: G) -> Selfwhere F: F1Once<A, Ret = X>, G: F1Once<X, Ret = B>,

See Compose

source

pub fn chain<A, B, X2, G2>(self, g2: G2) -> Compose<Compose<F, G, X>, G2, X2>where F: F1Once<A, Ret = X>, G: F1Once<X, Ret = X2>, G2: F1Once<X2, Ret = B>,

Trait Implementations§

source§

impl<F, G, A, X, C> F1<A> for Compose<F, G, X>where F: F1<A, Ret = X>, G: F1<X, Ret = C>,

source§

fn call(&self, a: A) -> C

Call the function
source§

impl<F, G, A, X, C> F1Once<A> for Compose<F, G, X>where F: F1Once<A, Ret = X>, G: F1Once<X, Ret = C>,

§

type Ret = C

The type returned by this function
source§

fn call1(self, a: A) -> C

Call the function
source§

fn chain<G, C>(self, g: G) -> Compose<Self, G, Self::Ret>where Self: Sized, G: F1Once<Self::Ret, Ret = C>,

Create a new function that passes this one’s output to g’s input Read more

Auto Trait Implementations§

§

impl<F, G, X> RefUnwindSafe for Compose<F, G, X>where F: RefUnwindSafe, G: RefUnwindSafe, X: RefUnwindSafe,

§

impl<F, G, X> Send for Compose<F, G, X>where F: Send, G: Send, X: Send,

§

impl<F, G, X> Sync for Compose<F, G, X>where F: Sync, G: Sync, X: Sync,

§

impl<F, G, X> Unpin for Compose<F, G, X>where F: Unpin, G: Unpin, X: Unpin,

§

impl<F, G, X> UnwindSafe for Compose<F, G, X>where F: UnwindSafe, G: UnwindSafe, X: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<F, A, TF, T> Sequence<F, A, TF> for T

source§

fn sequence<Ap>(self) -> Ap::T<F::T<A>>where Self: Sized + Traversable<F, Ap::T<A>, A, TF> + Foldable<F, Ap::T<A>>, Ap: HKT1, Ap::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, Ap::T<F::T<A>>: Applicative<Ap, F::T<A>> + ApplyOnce<Ap, F::T<A>>, F: HKT1<T<Ap::T<A>> = Self>,

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.