As promised, here is the link for the proposal:
UFCS: Unified Function Call Syntax, i.e. why you can do Type::method(&this, params). UMCS: Unified Method Call Syntax, i.e. allowing you to do foo.function(params) in some fashion for free function instead of requiring associated method lookup.
Some sort of "pipe" operator has been considered desirable for a while, e.g. item |> function(param) translating to function(item, param), potentially including autoref behavior. The thing is, Rust already has a "pipe" operator: the applicative .. The "o…
Regarding the question:
If I'm not mistaken, val.(Ok)
creates a closure equivalent to || Ok(val)
. To actually execute the function and get Ok(val)
, we need the trailing parentheses:val.(Ok)()
.
1 Like