Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Any way to avoid iterating by index?
Given the following case:
code (click for more details)Is there any way to avoid:
compiler error (click for more details)Without resorting to an index-based workaround via .iter().enumerate()
or equivalent? It seems to be a rather straightforward reference flow for the borrow checker to handle, yet none of my attempts seem to have worked so far.
Including those to manually drop
the similar
itself, self.list.iter()
saved to a separate variable beforehand, or manual 0..self.list.len()
iteration with borrowing by index.
2 posts - 2 participants
🏷️ Rust_feed