Pixel Pedals of Tomakomai

北海道苫小牧市出身の初老の日常

2020-07-26から1日間の記事一覧

Rustの&mutのmoveとreborrow

&mut は Copy trait を 実装していない 。よって、こちらは実行できない。 fn main() { let x: &mut i32 = &mut 0; { let y = x; println!("y: {}", y); } println!("x: {}", x); } Compiling playground v0.0.1 (/playground) error[E0382]: borrow of move…