2017-01-19から1日間の記事一覧

References and Borrowing #2

https://doc.rust-lang.org/book/references-and-borrowing.html 変数書き換え不可にするのは大変なんだな。 let mut x = 5; { let y = &mut x; // -+ &mut borrow starts here *y += 1; // | } // -+ ... and ends here println!("{}", x); // <- try to bo…