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

References and Borrowing

https://doc.rust-lang.org/book/references-and-borrowing.html を途中まで。 特別気になる箇所はなし。 fn main() { fn sum_vec(v: &Vec<i32>) -> i32 { return v.iter().fold(0, |a, &b| a + b); } fn foo(v1: &Vec<i32>, v2: &Vec<i32>) -> i32 { let s1 = sum_vec(v1);</i32></i32></i32>…