programming について調べたことを整理していきます


Rust: occured error when using closure without type annotation.

I'm studying Rust and trying to write Rust code using closure. I found some confusing error about Type Inference of Rust. This post is just a memorandum of understanding for mechanism of Rust. fn main() { // closure // argument x is set wi…

Rust: Error for copying String allocated memory to new variable.

When I write Rust code as below, it occurs error. I tried to print two same String by copying memory. fn main() { let s1 = String::from("Hello"); let s2 = s1; println!("{}, {}", s1, s2); } error[E0382]: use of moved value: `s1` --> src/mai…