Macro join::try_join[][src]

try_join!() { /* proc-macro */ }

Use to combine results. It transposes tuple of Results/Options into Result/Option of tuple or single Result/Option in case of 1 branch.

Example:

extern crate join;

use join::try_join;

let product = try_join! {
    Ok::<_,()>(2) |> |v| v + 2,
    Ok::<_,()>(3),
    Ok::<_,()>(4),
    map => |a, b, c| a * b * c
}.unwrap();

assert_eq!(product, 48);