Precedence in rust?


#1

such as how to interpret

&x[0].method()

thanks!

I tried to find the answer in the reference, but did not.


#2

That example is the same as &(x[0].method()). There is an operator precedence section, I think it is correct to model the method-call . as a binary operator with the strongest precedence (i.e. above as).


#3

Thanks. how about index? bind tightest I guess? the reference only talk about operator precedence. I did not find information about the method call and index precedence relative to operators. they often mix together.


#4

I filed an issue about . missing from the precedence chart but apparently it’s not an operator. It still needs explaining somehow though. Precedence makes the most sense to me.

I was also told it should have highest precedence.