-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Dynamic queries and builder API #9774
Merged
alice-i-cecile
merged 57 commits into
bevyengine:main
from
james-j-obrien:dynamic-term-builder
Jan 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
b56e1c7
Fully dynamic term based query builder
james-j-obrien 5917065
System installation of dynamically built queries
james-j-obrien b7f04df
Fix change detection, add Changed and Added
james-j-obrien 07dc116
Add additional tests, fix bugs and clean up
james-j-obrien a12b5dd
Add trivial examples
james-j-obrien f6382c1
Performance tweaks
james-j-obrien 25623dc
Add dynamic reference methods
james-j-obrien c16e0ec
Fix rebase issue
james-j-obrien 799b318
Remove examples so github is less angry, rename builder methods to be…
james-j-obrien 711653b
Better builder method names
james-j-obrien ff1e33a
Major perf improvements, add additional dynamic builder methods
james-j-obrien 40bd8c5
Remove closures from hot loop, remove more runtime checks
james-j-obrien d0736f5
Remove allocations from hot loop
james-j-obrien c3d37da
Minor cleanup
james-j-obrien 353c248
Remove #[inline(always)] where it doesn't improve or degrades perform…
james-j-obrien 40c1c62
Flatten terms
james-j-obrien 7667c0a
Fix AnyOf issue
james-j-obrien 031779c
Reorder impls to be more intuitive
james-j-obrien 5494b28
Add dynamic_query example
james-j-obrien 688459d
First docs pass, bug fixes and minor improvements
james-j-obrien 666edb3
Improve documentation, add additional utility functions, add benches
james-j-obrien 5ac0e50
Remove temporary test
james-j-obrien 9d6382f
Minor cleanup
james-j-obrien f7abf12
First CI pass
james-j-obrien 5c880e9
Second CI pass
james-j-obrien 7680abd
Third times the charm
james-j-obrien 7bd46ab
Add comments
james-j-obrien db48ac8
Flatten terms, remove branching where possible
james-j-obrien 02091d9
Fix example
james-j-obrien 9a3f5b3
Static iteration, remove FetchedTerm and FetchBuffer
james-j-obrien 88ba5e3
Cleanup component ptr access
james-j-obrien 2cf8f1e
Tidy docs slightly
james-j-obrien 9c65312
Swap to constants to speed up dense iteration, minor API cleanup
james-j-obrien e9c7861
Consistency pass
james-j-obrien c674c4a
Move to pointers from iterators, split fetch and filter terms
james-j-obrien 5952756
Add From<Mut<T>> For MutUntyped
james-j-obrien a76370c
FilteredAccess based implementation
james-j-obrien 323cc74
Merge branch 'dynamic-term-builder' into query-builder
james-j-obrien ce0ea41
Merge branch 'bevyengine:main' into dynamic-term-builder
james-j-obrien 89f1eac
Doc fixes
james-j-obrien bf9cee7
Merge branch 'dynamic-term-builder' of https://github.com/james-j-obr…
james-j-obrien 32a6796
Add compile fail tests, add safety comments to example
james-j-obrien 289ca79
Merge main
james-j-obrien 52e0391
Learn how to spell required correctly
james-j-obrien fecd6bc
Merge main, incorporate feedback
james-j-obrien 04d88cc
Fix doc test
james-j-obrien 3bfcc3f
Fix docs and compile fail tests
james-j-obrien 60c006f
Fix trailing newline
james-j-obrien b59bb38
Fix trailing whitespace...
james-j-obrien cf951bb
Merge branch 'main' into dynamic-term-builder
james-j-obrien 2e8a197
Remove unused import
james-j-obrien 5c98ef4
Improve safety comments
james-j-obrien 6f6a0cc
Merge main
james-j-obrien 63f97a3
Address remaining feedback
james-j-obrien 056ff2a
Merge branch 'main' into dynamic-term-builder
james-j-obrien a3ab076
Fix panic strings
james-j-obrien 8c1bbb0
Fix doc test
james-j-obrien File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
First CI pass
- Loading branch information
commit f7abf1232eb45d9bb32e0b732fd0d85e575bdd24
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 would like more clarity here if possible. Ideally we can point to exactly where the invariants are documented, and which ones are memory safety concerns.
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.
The tricky part here is this function allows you to modify any system param state, including user defined system params. That means that we can't really know all the invariants that need to be maintained here. We could try and list invariants for existing system params though e.g. if you change the
ComponentId
that aRes
stores it will point to the wrong component and cast it in an unsafe way. These invariants aren't currently listed anywhere as there was no safe or unsafe way to break them.Exposing the state directly like this is a little hacky. My preferred solution would be a macro that generates syntax like this:
I didn't want to add that in this PR as it requires a new proc macro and this PR is already big enough, it helps in that the invariant just becomes "make sure the new state is valid" rather than "make sure you don't make invalid edits to the state". I'm open to a safer approach but I'm not sure what that looks like.
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 feel like this API is too hard for the user to use safely and we should maybe punt this to a separate pr and see if we can provide a safe panicking version similar to
Query::transmute