Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andriyDev opened this issue May 13, 2025 · 1 comment
Closed

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

andriyDev opened this issue May 13, 2025 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@andriyDev
Copy link
Contributor

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.

@andriyDev andriyDev added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! labels May 13, 2025
@andriyDev
Copy link
Contributor Author

This was actually already implemented in #19071. My mistake!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

1 participant