Skip to content

Allow implementing Collection with non-ref iterator #58

Description

@florian1345

It would be nice to implement the Collection trait on types that do not hold the data directly, but rather construct it at iteration time. As an example, a set of numbers in the range 0..64 may be represented as a bit field, with an iterator going through the bits and tracking the index. This iterator would return owned numbers, not references, thus not satisfying the requirements for Collection::Iter.

A potential solution would be to somehow adapt the Collection trait to allow any kind of items, or to offer some form of API to easily convert between a Collection with owned iterator and one with some sort of cache that has an iterator on references.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions