Closed atornity closed 9 months ago
OK so I learned something new from this. I did not know that you could capture a generic function in a non-generic struct. I imagine that there are lots of other places in the code which could also be simplified with a better understanding of Rust types.
I'm going to accept this, but you should know that this code is going to be replaced soon - Bevy just a few days ago added the ability to get change ticks for a resource by id, so we won't need the type erasure any more.
Thanks for doing this!
Glad you learned something new! Yeah, it's pretty OP.
It's great that they're adding that, I was a bit confused when I couldn't find that function earlier.
I don't think the
AnyResource
trait does anything here other than erasing the generic type ofTrackedResource
so I removed it and added a fn pointer toTrackedResource
instead.I also removed the
PartialEq
andEq
derives, not sure if those were intended to be used somewhere or not?This change is kinda pointless but it removes some lines of code :D