Impl Reflect for Box<[T]> - #11646
Conversation
doonv
left a comment
There was a problem hiding this comment.
I like this, but I'm not particularly a fan of the FixedLenList name. But I don't have a better name to suggest.
Yes me too. |
|
name suggestions / general ideas:
but I also think that |
pablo-lua
left a comment
There was a problem hiding this comment.
Liked this changes and this sure can be useful in importing the std types into reflection, but there is something bugging me, and commented on that.
Liked the name |
pablo-lua
left a comment
There was a problem hiding this comment.
I'm on board with this, the user can probably do some performances improvements with something that they knows that has a fixed len. And helping the user to get reflection on Box<[T]> is good too.
Co-authored-by: pablo-lua <126117294+pablo-lua@users.noreply.github.com>
|
Why not just |
Because an |
|
Ahh... |
soqb
left a comment
There was a problem hiding this comment.
gah! another Cow<Foo>/Box<Foo>/&Foo inconsistency. starting to think we should somehow have ReflectUnsized/ReflectBorrow traits which make things easier.
regarding the implementation, i would rather we used List and bit the performance pain point of just reallocating via Vec (using this From impl and Vec::into_boxed_slice) on every insertion since i think trait complexity is already extremely high in Reflect (and only going up).
|
It may be a good idea to start with a simple implementation and revisit later if it's proving a hotspot |
Reflection can only be accessed at runtime, so |
|
This PR appears to have gone stale. Nominating to close. |
|
I would like to rework on this if necessary. What is blocking on this PR (other than author inactive)? Was the naming bikeshed unresolved? |
Objective
ReflectforBox<[T]>#11570.Solution
Implements one the solutions proposed in #11570 (comment).
FixedLenListas super trait ofList.Changelog
FixedLenListtrait as a super trait ofListwhich contains all the methods that did not change the size of the list (e.g.insert,remove, etc.).ReflectforBox<[T]>as aFixedLenList.Migration Guide
ReflectRef,ReflectMutandReflectOwnedhave a new variant namedFixedLenList.Accessing a fixed len list from one of these enum may require some boilerplate code :
Listmust also implementFixedLenListListtoFixedLenListgetget_mutlenis_emptyiterclone_dynamic