Support the `|>` pipe operator

Similar to ocaml, F#, Elixir,

    "Rust Rocks!" 
    |> println!;

https://elixirschool.com/en/lessons/basics/pipe_operator

1 Like

Support for macros like println will be even harder, since you'd then have to make up a fake syntax tree to pass to them

2 Likes
trait Println {
    fn println(&self);
}
impl Println for str {
    fn println(&self){
        println!("{}",self)
    }
}
fn main(){
    let a="123";
    let b=a.to_string();
    a.println();
    b.println();
}

why we need the |> operator?

Why start a new thread about this when one is already ongoing? When will Rust adopt the syntax of pipline operator "|>" in ocaml - #7 by Finn

6 Likes

totally missed the other thread. Thank you

@Neutron3529 this is closer to functional syntax. Benefits of more compositional and cleaner code

I'm going to go ahead and lock this topic.

If you want to continue discussing the pipeline operator, check out the other one.

2 Likes