I Just Learned About References. I Feel a bit Embarassed

127 points ever-ella77 65 comments

I dont need to clone everything, I can just reference it! All hail the &!

This is probably a bit silly to most Rust devs but damn I wish I knew this sooner. I need to read the docs more-

One thing I'm unsure about is if referencing a variable will avoid moving it, as I run into that problem a lot, but for now it does what I need it to. I still need to learn more about ownership I think.