Skip to content

Rely on Default + Clone auto-impl for FromTemplate where possible#23940

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
cart:use-auto-templates
Apr 22, 2026
Merged

Rely on Default + Clone auto-impl for FromTemplate where possible#23940
alice-i-cecile merged 1 commit intobevyengine:mainfrom
cart:use-auto-templates

Conversation

@cart
Copy link
Copy Markdown
Member

@cart cart commented Apr 22, 2026

Objective / Solution

Manual FromTemplate derives are unnecessary for anything that doesn't require custom template logic. Letting a type be a template for itself is less confusing, has fewer corner cases, and does less codegen.

The rule of thumb to follow is "Use Default + Clone for anything that doesn't need custom template logic". In the case of #23924, the only type that needs custom template logic is Scrollbar, because it has the target: Entity field, which benefits from having an "entity template".

@cart cart added this to the 0.19 milestone Apr 22, 2026
@cart cart added C-Code-Quality A section of code that is hard to understand or change A-Scenes Composing and serializing ECS objects labels Apr 22, 2026
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Apr 22, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 22, 2026
Merged via the queue into bevyengine:main with commit af10628 Apr 22, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Scenes Composing and serializing ECS objects C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants