Title: Hands-On Rust (Chapter 10: Iterating Away the Chaos)
in the iteration
function, why is it necessary to return a clone of new_tiles
(which was already cloned from map.tiles
?)
Title: Hands-On Rust (Chapter 10: Iterating Away the Chaos)
in the iteration
function, why is it necessary to return a clone of new_tiles
(which was already cloned from map.tiles
?)
That’s actually a very good question. It appears to work fine without it (it replaces the copy with a move; both compile down to memcpy
so it winds up not making a lot of difference in terms of performance). My notes indicate that I had problems with an earlier Rust compiler there, so I’m going to test the heck out of it before committing the change. Thanks!
Yeah, I skipped it, and now that I have things wired up it seems to work fine. Guess I’ll let you know if I stumble across some issue.
I have a build (I wish I had room to include it in the book) that plays itself over and over. After a few hours, no errors with the clone omitted - so it’ll be trimmed for the next beta. Thanks!