Skip to content
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

#[derive(Bundle)] should support sub bundles #4058

Closed
CAD97 opened this issue Feb 28, 2022 · 2 comments
Closed

#[derive(Bundle)] should support sub bundles #4058

CAD97 opened this issue Feb 28, 2022 · 2 comments
Labels
A-ECS Entities, components, systems, and events C-Enhancement A new feature

Comments

@CAD97
Copy link
Contributor

CAD97 commented Feb 28, 2022

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

The following code shape should work:

#[derive(Bundle)]
struct PhysicsSpriteBundle {
    sprite: SpriteBundle, // impl Bundle
    rigid_body: RigidBody, // impl Component
    collision: CollisionShape, // impl Component
}

What solution would you like?

Use autoref specialization (or autoderef specialization) to appropriately either use the field impl Component directly or recurse into the field impl Bundle.

What alternative(s) have you considered?

  • Put the components from the "sub bundle" directly into the new bundle.
  • Use setup system instead of bundle.
  • Use plugin instead of bundle.

Additional context

Ran into during Bevy Jam #​1. Bevy 0.6.1.

@CAD97 CAD97 added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Feb 28, 2022
@alice-i-cecile
Copy link
Member

Are you aware of the #[bundle] field annotation? Will that meet your needs?

Also #2974 will solve this directly.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events and removed S-Needs-Triage This issue needs to be labelled labels Feb 28, 2022
@CAD97
Copy link
Contributor Author

CAD97 commented Feb 28, 2022

Ah, I didn't see that, I'm sort of moving too fast in jam mode 🙃

It's nice to see that this is already sort of planned to end up just working, though!

I'm closing this, as the direct request is served by the bundle attribute.

@CAD97 CAD97 closed this as completed Feb 28, 2022
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-Enhancement A new feature
Projects
None yet
Development

No branches or pull requests

2 participants