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
use super::impls::PipeVal;
use super::structs::PipeBox;

pub fn pipe<'a, Value: 'a>(value: Value) -> PipeBox<'a, Value> {
    PipeBox::from_val(value)
}

#[cfg(test)]
mod tests {
    use super::*;
    use super::super::*;

    #[test]
    fn pipe_works() {
        let expected = ((3 + 1) / 2).to_string();

        let received = pipe(3)
            .map(|x| x + 1)
            .map(|x| x / 2)
            .map(|x| x.to_string())
            .unwrap();

        assert_eq!(received, expected);
    }
}