How do I know if I am doing it right?

117 points ahsan2649 27 comments

With most programming languages, ideas flow down the pipeline of "make classes, make variables, make functions and call functions". Using libraries in those languages also boil down to the same thing.

With Rust, I'm always wondering where my variables should be declared, and if I should be passing it directly (moving) or just as a reference (borrowing). I still haven't wrapped my head around lifetimes yet, though I guess getting over that should give one a better idea of the code flow.

It feels like passing everything as a mutable ref makes Rust just the same as any other language, but at the same time doing so feels like bad coding practices.

I could use some epiphanies to clear things out. Thank you!