Skip to content

Derive Macro for MapEntites #17611

Open
@jonathandw743

Description

@jonathandw743

What problem does this solve or what need does it fill?

Would remove boilerplate like

impl MapEntities for Foo {
    fn map_entities<M: EntityMapper>(&mut self, entity_mapper: &mut M) {
        self.a.map_entities(entity_mapper);
        self.b.map_entities(entity_mapper);
    }
}

What solution would you like?

A derive macro which can implement MapEntities for any struct where all its attributes implement MapEntities (like Debug and Default do).

What alternative(s) have you considered?

Just implementing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-MacrosCode that generates Rust codeD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions