Skip to content

Associated function new is not defined for any hasher on HashMap #65404

Closed
@Alphare

Description

@Alphare

HashMap with a custom hasher does not implement new(). Example, with the following type alias:

type FastHashMap<K, V> = HashMap<K, V, MyFastHasher>;

let h = HashMap::new();  // Works
let f = FastHashMap::new();  // No associated function, etc.

Is there a good reason why that should happen? I've resorted to using default() since it does the same thing AFAIK, but this seems like an unnecessary restriction.

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