Skip to content

MapEntities is not implemented for nested types in collections. #19198

Closed
@andriyDev

Description

@andriyDev

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

The following does not currently compile:

#[derive(Serialize, Deserialize, MapEntities)]
struct PlayerSaveData {
  entity: Entity,
  position: Vec2,
  velocity: Vec2,
}

#[derive(Serialize, Deserialize, MapEntities)]
struct PlayerSaveStage(#[entities] Vec<PlayerSaveData>);

The problem is that Vec<PlayerSaveData> does not implement MapEntities. Vec<Entity> does however. This means I have to manually implement MapEntities for PlayerSaveStage even though it's incredibly trivial.

What solution would you like?

Implement MapEntities for Vec<T> where T: MapEntities. This should automatically work for Entity since Entity: MapEntities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions