Skip to content

Support for owned keys in idmap (!Copy) #2

@Techcable

Description

@Techcable

The IntegerId trait currently requires the type to be Copy, which reduces flexibility for a key type used in an idmap.

The current implementation of DirectIdMap does not actually store keys, meaning it needs to summon keys from the integer index.

One potential solution is to require a separate IntegerKey trait for idmaps. There can be a blanket implementation for IntegerId that stores a ZST but also allows owned keys that need a real value to be stored.

I ran into this problem working on switching dropping-thread-local from a hashmap to an idmap. Key types are reference counted to avoid freeing keys currently in use, which means keys must be !Copy.

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