Pipe

Trait Pipe 

Source
pub trait Pipe {
    // Provided method
    fn pipe<B, F>(self, f: F) -> B
       where Self: Sized,
             F: Fn(Self) -> B { ... }
}
Expand description

Adds chaining methods pipe to every type.

Provided Methods§

Source

fn pipe<B, F>(self, f: F) -> B
where Self: Sized, F: Fn(Self) -> B,

Converts the value by applying the function f.

§Examples
use chaining::*;

let times6 = |i: i8| i * 6;
let i = (1 - 2 - 3).pipe(times6).pipe(i8::abs);

assert_eq!(24, i);

Implementors§

Source§

impl<A> Pipe for A