Timeline for 12 Days of Christmas in Rust
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 11, 2020 at 11:00 | comment | added | mickdekkers | Thanks for the comments everyone! I also learned some new things here :D @OllyBritton I'm glad to have helped! If my answer helped sufficiently, could you mark it as accepted? Thanks! | |
Jan 10, 2020 at 17:54 | comment | added | Olly Britton | Thanks for the great answer -- this has been invaluable and has taught me a lot, definitely motivated me to keep learning! | |
Jan 8, 2020 at 19:35 | comment | added | Shepmaster |
(&LYRICS).iter() can just be LYRICS.iter()
|
|
Jan 8, 2020 at 19:33 | comment | added | Shepmaster |
no longer an i variable to check — Iterator::enumerate .
|
|
Jan 8, 2020 at 19:32 | comment | added | Shepmaster | What's an idiomatic way to print an iterator separated by spaces in Rust? | |
Jan 8, 2020 at 17:47 | comment | added | JayDepp |
@Alexander-ReinstateMonica I think you can only join on a slice, not from an iterator, so you'd have to do start.push_str(&LYRICS[12 - day..].join("\n")) . Note that this will allocate to make the String of the lyrics joined together, then copy that into start .
|
|
Jan 8, 2020 at 14:57 | comment | added | Alexander |
I think you can just start.push_str((&LYRICS).iter().skip(12 - day).join("\n"))
|
|
Jan 8, 2020 at 9:30 | comment | added | Toby Speight | Thanks for this great answer - I hope to see more from you in future! | |
Jan 8, 2020 at 9:20 | review | First posts | |||
Jan 8, 2020 at 9:30 | |||||
Jan 8, 2020 at 9:18 | history | answered | mickdekkers | CC BY-SA 4.0 |