Skip to content

[Variant] Improve API for iterating over values of a VariantList #7685

Closed
@alamb

Description

@alamb

At the moment iterating over the fields produces an iterator of Result which is annoying to deal with and doesn't play very well with most other Rust iterator combinators (like map, for example)

This is a tracking issue for a conversation @scovich and I had about how to improve iterating over a VariantList / fields of a VariantObject


Something I noticed here was that it would be really nice if:

  1. This returned an Iterator rather than a Result
  2. We could implement iter() and IntoIterator for VariantList

That would make using it more ergonomic, though it would require either panic'ing or else validating the offsets on construction 🤔

Originally posted by @alamb in #7666 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions