Need Assistance?

support@tutorialshub.in

Collections in Rust

Iterating & Mutating Collections Safely

ADVERTISEMENT
Rust Free Lesson
5 min read
ADVERTISEMENT

You can iterate over a vector by immutable reference (for x in &vec) or mutate elements in place (for x in &mut vec) using the dereference operator *x.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you