Stringの生成

文字列 (String)の生成から、各トレイトの理解が重要であることがわかる。

let s = "hello".to_string();  // ToString
let s = String::from("hello"); // From
let s: String = "hello".into(); // Into
let s = "hello".to_owned();  // ToOwned

参照

The Common Rust Traits - Rustifications

Conclusion: Why are there So Many Ways to Create a String?