-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Implement Reflect for arrays #1213
Description
What problem does this solve or what need does it fill?
Currently, only Vec can be reflected on. Sometimes it's more convenient to store data in an array, and currently it isn't possible to implement Reflect for types that have fields that are arrays.
What solution would you like?
Implement Reflect and List for arrays. It should be possible either via a macro which implements it for common array sizes (1-32, and maybe some powers of 2) or by taking advantage of const generics (currently nightly only).
What alternative(s) have you considered?
For my particular use case, a tuple would have worked as well, but tuples currently don't implement Reflect either. Another option is to just use a Vec, but it doesn't enforce a specific number of elements the way that arrays do.
Edit: Removed the bit about slices. Reflect can't be implemented for slices because of the lifetime.