tao_of_rust::ch05::share_mutable
pub fn immut_and_mut()
Base usage: 绑定默认不可变
fn main() { let x = "hello".to_string(); // cannot borrow immutable local variable `x` as mutable // x += " world"; }Run
Base usage: 结构体默认没有实现Copy
fn main() { let mut x = "hello".to_string(); x += " world"; assert_eq!("hello world", x); }Run