{"blog_title":"Perl\u65e5\u8a18","version":"1.0","categories":["Rust"],"image_url":null,"provider_name":"Hatena Blog","published":"2022-06-07 21:35:37","title":"Rust \u306e to_owned() \u3063\u3066\u4f55","author_name":"rightgo09","author_url":"https://blog.hatena.ne.jp/rightgo09/","provider_url":"https://hatena.blog","width":"100%","description":"to_owned() https://doc.rust-lang.org/std/borrow/trait.ToOwned.html#tymethod.to_owned \uff06\u306e\u53c2\u7167\u306b\u5bfe\u3057\u3066\u4f7f\u3046 \u53c2\u7167\u5143\u306e\u5024\u3092\u30af\u30ed\u30fc\u30f3\u3059\u308b \u30af\u30ed\u30fc\u30f3\u3057\u305f\u4e0a\u3067\u6240\u6709\u6a29\u3082\u65b0\u898f\u306b\u3059\u308b\uff08\u53c2\u7167\u5143\u306e\u65b9\u306e\u6240\u6709\u6a29\u306f\u305d\u306e\u307e\u307e\uff09 \u4f8b fn main() { { let s1: &str = \"foo\"; let s2: &str = (&s1).to_owned(); println!(\"{}\", s1); println!(\"{}\", s2); } { let s1: String = \"bar\".to_string(); let s2\u2026","type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fr9.hateblo.jp%2Fentry%2F2022%2F06%2F07%2F213537\" title=\"Rust \u306e to_owned() \u3063\u3066\u4f55 - Perl\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://r9.hateblo.jp/entry/2022/06/07/213537","blog_url":"https://r9.hateblo.jp/","height":"190"}