News for hackers. Stuff that matters.
Re:Bevy: A data-driven game engine and app framework built i... by dgb23 on Tuesday August 11, 2020 @03:04PM (#24124474)
I have to say the API seems to be very pleasant and simple at a glance. Kudos to the author!

> Being able to use Rust functions directly as systems might feel like magic, but I promise it's not! You may have noticed that we do this when registering systems in our App (...)

> (...) This works because we implement the IntoQuerySystem trait for all functions that match a certain set of function signatures.

This pattern is a great example of how Rust achieves to be both very ergonomic or dynamic (in the sense of expressiveness) and type safe at the same time.

Re:Bevy: A data-driven game engine and app framework built i... by cthonicthulu on Tuesday August 11, 2020 @04:22PM (#24125536)
That's pretty cool! Is there any material you'd recommend me reading that gives examples of these kinds of ergonomics with traits as they pertain to, say, vanilla web development?
Re:Bevy: A data-driven game engine and app framework built i... by dgb23 on Tuesday August 11, 2020 @05:07PM (#24125981)
I merely a beginner and learn the language on the side.

Things that come to mind are (incomplete list):

- From trait

- derive

- traits you can implement to convert a data structure into a iterator

- Deref, Drop traits, MutexGuard

These things appear magical at first but make for very expressive abstractions.

In regards to web-dev: a framework that makes heavy use of traits and macros is Rocket.

As for material: when I’m learning I typically have The Book, Rust by Example and some tabs of the standard library open. Then just go by curiosity. Perhaps not the best approach?