Skip to content

Add resolution method option to associated-derive #1

Description

@ZacJW

Currently associated-derive uses match to resolve which constant it should return. This is fine when used with enums with consecutive discriminants or non-consecutive but not too sparse as Rust will compile the match to a jump table (even in debug builds).

However if the discriminants are very sparse, it will fall back to checking one-by-one which is linear time complexity with the number of variants.

Having other resultion methods, like some sort of binary search or a precomputed static hash table, could be very useful in those circumstances. Before they can be built, the user needs a way to chose which method to use, currently just "Match".

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