-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Minor refactors in change detection #21562
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are nice improvements! I especially like that you folded in the changed_by: MaybeLocation
; it seems like whenever we want to know "when" we'll also want to know "where", and keeping them together will make it harder to miss one if we use them elsewhere in the future. (Hmm, and it's also more obvious now that there's no added_by
. I wonder if we'll want that someday.)
Ticks
->RefComponentTicks
TicksMut
->MutComponentTicks
TickCells
->ComponentTickCells
It feels odd that Ref
and Mut
are prefixes, but Cells
is a suffix. I guess CellComponentTicks
wouldn't be right, though. Maybe ComponentRefTicks
/ComponentMutTicks
/ComponentCellTicks
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this, but this needs a migration guide since we're changing pub types.
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
My goal was to make |
Objective
While tinkering with change detection, I've collected some nitpicks:
Ticks
is a nice name for a struct, but it's taken by apub(crate)
struct that's pretty niche. (I don't have any plans for theTicks
name, but it could be useful for something.)Ticks
,TicksMut
, andTickCells
is accompanied by aMaybeLocation
that represents the calling location that last modified the component, so it should just be part of the structs.NonSend
seems to be in the wrong file, and doesn't implement methods with the macros that every other change-detecting query parameter uses.Solution
Renamed the following structs:
Ticks
->RefComponentTicks
TicksMut
->MutComponentTicks
TickCells
->ComponentTickCells
Added a
changed_by: MaybeLocation
field toRefComponentTicks
,MutComponentTicks
, andComponentTickCells
and folded in the looseMaybeLocation
s.Moved
NonSend
fromsystem/system_param.rs
tochange_detection.rs
and updated its implementation to match similar query parameters.Removed
ComponentTickCells::read
because it is now unused (and not public).