Rust lambdas look like this:
|ar,gs| expr
So `|| expr` is just a lambda function that takes no arguments and evaluates to `expr`.It is a lambda function with no parameters.
The argument of then() is a function which is evaluated only if the bool is true.
Re:Rust 1.50
by laszlokorte on Thursday February 11, 2021 @03:53PM
(#26107002)
empty parameter list of a closure.
rust: |x| x+x
swift: {x in x+x}
rust: || 42
swift: { 42 }
edit: thanks all, should have known it was a lambda :D, in Swift we can omit this. My first thought seeing "||" was some type of OR logic since it's in the context of if/else