Function ea::chain [−][src]
pub fn chain<R>(result: R) -> Chainable<R>
A function that take an expression which return a single value or object then return a Chainable then it can be chain with other function/closure with method chain of Chainable.
Example
use ea::chain; fn function1(a : i32, b : i32, c : i32) -> i32 { a + b + c } fn function2(d : i32) -> i32 { d + 1 } let var = 2; let chained = chain(function1(1, 2, 3)) .chain(function2) .chain(|param| param + 2) .chain(move |param| param * var); assert_eq!(18, *chained); // Chainable struct implement Deref to obtain final result. // There's also `end` method that consume Chainable and return result. assert_eq!(18, chained.end()); // chained no longer exist as it was consumed by end()