[][src]Trait frunk::traits::Func

pub trait Func<Input> {
    type Output;
    fn call(i: Input) -> Self::Output;
}

This is a simple, user-implementable alternative to Fn.

Might not be necessary if/when Fn(Once, Mut) traits are implementable in stable Rust

Associated Types

type Output

Loading content...

Required methods

fn call(i: Input) -> Self::Output

Call the Func.

Notice that this does not take a self argument, which in turn means Func cannot effectively close over a context. This decision trades power for convenience; a three-trait Fn heirarchy like that in std provides a great deal of power in a small fraction of use-cases, but it also comes at great expanse to the other 95% of use cases.

Loading content...

Implementors

Loading content...