Hands-on Rust: Add note about `.sort_by` (page 92-93 in P1.0)

The build_corridors function introduces the sort_by utility in Vec. The call appears like this:

rooms.sort_by(|a,b| a.center().x.cmp(&b.center().x));

I believe it would help readers understanding why a is used directly, whereas &b is referenced.

1 Like

Thanks again! I’ve added this to the “mysterious future” bug tracker; if there’s a 2nd edition, it’ll be on my task list. I hope you’re enjoying the book. :slight_smile:

1 Like

Thank you! Very enjoyable book, very didactic, and a pleasant look into whole game developments (never wrote a game; clearly challenging) !