#Get all ressources that implement a trait.

8 messages · Page 1 of 1 (latest)

stark burrow
#

Hello i'm wondering if it is possible to get all the ressources that implement a specific trait ?

#

Some thing of the sort: ```rust
trait T {}
fn get_all_res(mut res: ResMut<dyn T>) {}

smoky snow
#

No

#

This is effectively a variant on trait queries

#

It may be feasible in the future, but there's no good way to do this

#

What's your use case? 🙂

stark burrow
#

Have a bunch of ressources representing settings then have a system that takes theses and build a menu to change these.

idle peak
#

out of curiosity, what would you expect res to be? would it be the first resource matching? or an iterator? or would get_all_res be called for each matching resource?