Been wanting to learn more about rust so I followed the Raytracing in One Weekend book and wrote a raytracer called shrimpray: *click*
I tried avoiding passing mutables to functions so lots of Option<T> and structs instantiated in the function are returned instead. I'm hoping this is a more rust style of things.
This is my first project in rust so any advice would be cool like improving performance and stuff
Looks pretty good. You talk about avoiding mutable, but what would you consider the alternative to returning options? Optionally writing to a passed mutable pointer? Ew, we have an optimizer to pick the best return method for us.
Only thing I noticed is that it's a bit better to keep the thread_rng value around, because each call involves incrementing and decrementing a reference count. Luckily it's not an atomic reference count, so it probably doesn't really matter, and it isn't in the expensive part of the code either.