-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
reflect: insert
and remove
methods for List
#7061
Comments
Yep, if we can have a default impl for this I'm on board. Probably warn in the trait docs that manual impls may be faster. |
trying to implement this. for the signature of edit: |
I’m in favor of just matching |
# Objective - Fixes bevyengine#7061 ## Solution - Add and implement `insert` and `remove` methods for `List`. --- ## Changelog - Added `insert` and `remove` methods to `List`. - Changed the `push` and `pop` methods on `List` to have default implementations. ## Migration Guide - Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. Co-authored-by: radiish <[email protected]>
# Objective - Fixes bevyengine#7061 ## Solution - Add and implement `insert` and `remove` methods for `List`. --- ## Changelog - Added `insert` and `remove` methods to `List`. - Changed the `push` and `pop` methods on `List` to have default implementations. ## Migration Guide - Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. Co-authored-by: radiish <[email protected]>
# Objective - Fixes bevyengine#7061 ## Solution - Add and implement `insert` and `remove` methods for `List`. --- ## Changelog - Added `insert` and `remove` methods to `List`. - Changed the `push` and `pop` methods on `List` to have default implementations. ## Migration Guide - Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. Co-authored-by: radiish <[email protected]>
What problem does this solve or what need does it fill?
Currently, the reflect
List
trait implements onlypush
andpop
functionality. There is no way to insert or remove elements other than from/to the end other than by downcasting. This is especially notable using types likeVecDeque
with reflection.What solution would you like?
Add
insert
andremove
methods forList
and implement them.Give
push
andpop
default implementations using on theinsert
/remove
andlen
methods.What alternative(s) have you considered?
We might not need to implement the methods by default but since we can I believe we should as to not put to much burden on the implementor.
Additional context
Discussed first on discord.
The text was updated successfully, but these errors were encountered: