1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use TokenStream;
/// A macro that lets you use the pipeline operator with [Hack-like syntax](https://docs.hhvm.com/hack/expressions-and-operators/pipe).
///
/// ```rs
/// fn add(a: usize, b: usize) -> usize {
/// a + b
/// }
///
/// fn orig_and_double(num: usize) -> (usize, usize) {
/// (num, num * 2)
/// }
///
/// let num = 4;
///
/// let piped = pipe! {
/// num |> add(2, __) |> orig_and_double(__),
/// (_, doubled) |> doubled as isize,
/// };
///
/// assert_eq!(piped, 12isize);
/// ```
///
/// You can pass any expression in as the input.
///
/// Notice that you can chain pipelines with `,`s to destructure the result of the previous pipeline.