-
-
Save csknk/bf3cce9426cedec6d3ce9758dcbed382 to your computer and use it in GitHub Desktop.
Revisions
-
csknk revised this gist
Aug 19, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,6 @@ fn pluralize(s: String) -> String { p.push_str("s"); return p // This is ok - builds new String, which is moved out // s + "s" } -
csknk renamed this gist
Aug 19, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
rust-play created this gist
Aug 19, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ fn main() { let s = String::from("book"); let ss = pluralize(s.clone()); println!("One {}, many {}", s, ss); } fn pluralize(s: String) -> String { // Can't push_str directly onto s as s is not mutable let mut p = s; p.push_str("s"); return p // This is ok // s + "s" }