Skip to content

Move HashMap to alloc::collections #56192

Closed
@WildCryptoFox

Description

@WildCryptoFox

Can we move HashMap to alloc::collections?

std could use a type alias to assume the default, and use a trait to add the new and with_capacity methods back.

pub type HashMap<K, V, S = RandomState> = alloc::collections::hash_map::HashMap<K, V, S>;

pub trait HashMapExt {
  fn new() -> Self;
  fn with_capacity(n: usize) -> Self;
}

impl<K: Eq + Hash, V> HashMapExt for HashMap<K, V> {
  fn new() -> Self { .. }
  fn with_capacity(n: usize) -> Self { .. }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-collectionsArea: `std::collections`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions