Skip to content

Implement Reflect for arrays #1213

@TehPers

Description

@TehPers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ReflectionRuntime information about typesC-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions