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
/// Provides a convient syntax for fusing conduits. /// /// # Example /// /// ``` /// #[macro_use] extern crate plumbum; /// use plumbum::*; /// fn main() { /// use std::iter::FromIterator; /// use plumbum::{Conduit, Source, Sink}; /// /// let src = fuse!{ /// Source::from_iter(vec![42, 43]), /// Conduit::transform(|x| 1 + x), /// Conduit::transform(|x| 2 * x), /// Conduit::transform(|x: i32| x.to_string()) /// }; /// let sink = Sink::fold(Vec::new(), |mut v, x| { /// v.push(x); /// return v /// }); /// /// assert_eq!(src.connect(sink), vec!["86","88"]); /// } #[macro_export] macro_rules! fuse { ( $x:expr ) => { $x }; ( $x:expr , $( $t:tt )* ) => { $crate::ConduitM::fuse($x, fuse!{ $( $t )* }); }; }