piping
piping provides a pipe! macro that allows you to use the pipeline operator in Rust.
let wrapped = orig_and_double.1 as isize;
let piped = pipe! ;
Features
- Hack-like syntax.
- Multiple pipelines in one statement.
- Destructuring of previous pipeline results.
Docs
Documentation is provided on docs.rs.
How does it work?
let num = 4;
let piped = pipe! ;
// Expands to...
let piped = ;
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.
To use _ as it is normally in Rust, use __ instead.
The macro also tries to optimize the generated code to minimize the amount of reassigning done.