Rust Programming2026-02-10 13:50

How should we understand Rust references and borrowing?

独孤影
独孤影
Author

I’ve been learning Rust for a while now, but the concepts of references and borrowing are still a bit fuzzy.

let x = 5;
let y = &x; // 这是借用吗?
let z = &mut x; // 这又是什么?

I can’t memorize the rules for mutable and immutable borrowing. Is there a simple way to remember them?

56

Comments (0)

Login to comment

Login Now

Loading comments...