Open
Description
What problem does this solve or what need does it fill?
I working on https://github.com/projectharmonia/bevy_replicon and we do a lot of type erasure internally for perfomance and a nice API.
Sometimes I need to access a resource mutably by ID and other resources just as reference. Since we don't have something like World::resource_scope_by_id
, I do the inverse:
world.resource_scope(|world, registry: Mut<AppTypeRegistry>| {
world.resource_scope(|world, entity_map: Mut<ServerEntityMap>| {
world.resource_scope(|world, server_events: Mut<ServerEvents>| {
});
});
});
What solution would you like?
But it would be nicer to do it like this:
world.resource_scope_by_id(id, |world, resource| {
let mut registry = world.resource::<AppTypeRegistry>();
let mut entity_map = world.resource::<ServerEntityMap>();
let mut server_events = world.resource::<ServerEvents>();
// ...
});