Skip to content

Slab::drain() should return the indices of the elements #136

@tomaka

Description

@tomaka

When calling into_iter(), the Slab returns an iterator that yields (usize, T).

But when calling drain(), only Ts are returned, and the indices of the elements are lost.

This is an inconsistency in the API, but also knowing these indices is necessary for my use case.
I'm currently bypassing this with mem::replace(&mut slab, Slab::new()).into_iter().

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