Skip to content

lens::Index does not work on arrays #1138

Closed
@smmalis37

Description

@smmalis37

As per the title, when attempting to use a lens::Index on an array value I receive errors about Index and IndexMut not being implemented for the array. This is technically true, as they're only implemented on slices, not arrays. Arrays should coerce into slices, but something in all the generics is preventing that from happening. Using lens::Deref doesn't help here, as this is a real coercion and not a Deref impl. I ended up creating a lens::Field that simply indexes in its two closures, which feels unnecessary but works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    D-Easyjust needs to be implementedenhancementadds or requests a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions