Closed jasonzhouy closed 2 years ago
@jasonzhouy 感谢反馈。这个示例已经勘误过了。
这个代码示例下面的解释有点疑惑,place1会将内存地址转移给other,这里的内存地址指的是啥?
fn main() {
let place1 = "hello";
let place2 = "hello".to_string();
let other = place1;
println!("{:?}", addr_of!(other));
println!("{:?}", addr_of!(place1));
}
从上面的输出可以看出place1和other是不一样的地址
@uran0sH 感谢反馈。
“place1会将内存地址转移给other” 是指 place1 会移动,内存地址为变为 other 的。这里主要是想说明转移的是内存地址,可能文字描述有歧义吧,并不是指内存地址的值转移给other。
页码与行数
文本或排版错误
代码错误
Rust版本