@@ -45,8 +45,10 @@ If `foo` uses/produces an immutable borrow by default, use:
45
45
* The ` _mut ` suffix (e.g. ` foo_mut ` ) for the mutably borrowed variant.
46
46
* The ` _move ` suffix (e.g. ` foo_move ` ) for the owned variant.
47
47
48
- A consequence is that the iterator methods become: ` iter ` , ` iter_mut ` ,
49
- and ` iter_move ` .
48
+ However, in the case of iterators, the moving variant can also be
49
+ understood as an ` into ` conversion, ` into_iter ` , and ` for x in v.into_iter() `
50
+ reads arguably better than ` for x in v.iter_move() ` , so the convention is
51
+ ` into_iter ` .
50
52
51
53
** NOTE** : This convention covers only the * method* names for
52
54
iterators, not the names of the iterator types. That will be the
@@ -142,15 +144,3 @@ Another option would be `val` or `value` instead of `owned`. This
142
144
suggestion plays into the "by reference" and "by value" distinction,
143
145
and so is even more congruent with ` ref ` than ` move ` is. On the other
144
146
hand, it's less clear/evocative than either ` move ` or ` owned ` .
145
-
146
- ## ` into_iter `
147
-
148
- For the case of iteration, at least, it would make some sense to
149
- signal ownership transfer by treating the owned version as a
150
- conversion, ` into_iter ` . The main downside is that it would go against
151
- the general convention for ownership variants (and cannot be used as
152
- the general convention, because not all cases can be seen as
153
- conversions).
154
-
155
- Moreover, it's strange to see just the owning variant as a conversion
156
- -- why not ` as_iter ` , ` as_iter_mut ` , and ` into_iter ` ?
0 commit comments