File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,30 @@ in the order given by their associativity.
8585| ` = ` ` += ` ` -= ` ` *= ` ` /= ` ` %= ` <br > ` &= ` <code >| ; =</code > ` ^= ` ` <<= ` ` >>= ` | right to left |
8686| ` return ` ` break ` closures | |
8787
88+ ## Evaluation order
89+
90+ Most expressions include subexpressions. Unless otherwise stated on the
91+ expression's page, evaluation of these inner expressions is left to right as
92+ written in the source code.
93+
94+ For example, the two ` next ` method calls will always be called in the same
95+ order:
96+
97+ ``` rust
98+ # // Using vec instead of array to avoid references
99+ # // since there is no stable owned array iterator
100+ # // at the time this example was written.
101+ let mut one_two = vec! [1 , 2 ]. into_iter ();
102+ assert_eq! (
103+ (1 , 2 ),
104+ (one_two . next (). unwrap (), one_two . next (). unwrap ())
105+ );
106+ ```
107+
108+ > ** Note** : Since this is applied recursively, expressions are also evaluated
109+ > from innermost to outermost, ignoring siblings until there are no inner
110+ > subexpressions.
111+
88112## Place Expressions and Value Expressions
89113
90114Expressions are divided into two main categories: place expressions and
You can’t perform that action at this time.
0 commit comments