Aquacolor

Aquacolor



创建一个可变的可变引用

zcxsb · 2026-03-06 · 12浏览 · 未分类


在rust中引用为一种类型,借用为一种机制。

我们知道获得引用的方式为在变量前加入&

可变引用的方式为&mut

这种引用赋值给一个变量

let tmp = &xxx, let tmp = &mut xxx;

这种变量不可变

如果需要引用可变,即引用作为别的引用指向别的变量

let mut tmp = xxx;

此时需要是同类型的



©

comment 评论区

添加新评论

face表情



  • ©2026 bilibili.com

textsms
内容不能为空
昵称不能为空
email
邮件地址格式错误
web
beach_access
验证码不能为空
keyboard发表评论


star_outline 咱快来抢个沙发吧!




©2026 Aquacolor

Theme Romanticism2.2 by Akashi
Powered by Typecho