In Rust, what exactly are mutable and immutable borrows?
问题 I'm stuck with the Rust concepts of borrowing and mutable : #[derive(Debug)] struct Rectangle { height: u32, width: u32, } fn mut_area(rect_mut: &mut Rectangle) -> u32 { rect_mut.width /= 2; rect_mut.height * rect_mut.width } fn mut_string(s: &mut String) -> &str { s.push_str("!"); let len = s.len(); &s[0..len / 2] } fn main() { let mut rect = Rectangle { height: 50, width: 40, }; println!("original rect: {:?}", rect); let a = mut_area(&mut rect); println!("area of rect: {}", a); println!(