paint-brush
Mutable References or Mutable Variables? Decoding Rust's mut-mut-mutby@charnog
611 reads
611 reads

Mutable References or Mutable Variables? Decoding Rust's mut-mut-mut

by Denis GoncharSeptember 23rd, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Rust's memory safety is rooted in its ownership and borrowing mechanisms. This article delves into the intricacies of the mut keyword, distinguishing between mutable references and mutable variables. The key takeaway? Not all muts are created equal: mutable references allow altering the pointed-to value, whereas mutable variables with references can change where they point. A handy visualization trick using the = sign simplifies understanding these distinctions.
featured image - Mutable References or Mutable Variables? Decoding Rust's mut-mut-mut
Denis Gonchar HackerNoon profile picture
Denis Gonchar

Denis Gonchar

@charnog

L O A D I N G
. . . comments & more!

About Author

Denis Gonchar HackerNoon profile picture
Denis Gonchar@charnog

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite