Skip to content

Standard library should have a set module #2640

Closed

Description

@catamorphism

There's code in rustc that represents sets as hash maps with value type (), and that's a little hokey. Sets should be in the standard library.

Activity

  1. Dretch commented on Jun 20, 2012

    @Dretch
    Contributor

    It would also be nice to be able to pass in the hash/eq fns using ifaces, like:

    // somewhere in core
    iface eq { fn eq (a: self) -> bool; }
    iface hash { fn hash () -> uint; }
    
    // a set module constructor
    fn mk_set <V:eq hash copy> () -> set<V> { ... }
    
    // to construct a set of some type with eq and hash in scope:
    let s = set::mk_set();
    s.insert(...);
    

    Actually the same thing would be nice for maps, too.

  2. catamorphism commented on Jun 21, 2012

    @catamorphism
    ContributorAuthor

    @Dretch That would be good, yes.

  3. catamorphism commented on Jan 20, 2013

    @catamorphism
    ContributorAuthor

    b86c90b is a start towards this, but the usual set operations still need to be added.

  4. catamorphism commented on Jan 30, 2013

    @catamorphism
    ContributorAuthor

    b927e48 closes this. Thanks, @thestinger !

  5. added a commit that references this issue on Nov 6, 2022
  6. added a commit that references this issue on Jan 6, 2023
  7. added a commit that references this issue on Nov 19, 2025
  8. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions