Skip to content

RFC: make the stdlib more hierarchical #9208

Closed
@huonw

Description

Rust has a module system and so it seems like a waste to just export everything as std::foo and extra::foo: grep '^pub mod' | wc -l counts 53 and 50 direct exports respectively.

Low hanging fruit would be moving std::{i8,uint,f32, ...} to std::num::*.

Other possibilities (off the top of my head):

  • std:
    • ascii, c_str to str::* or even ascii, c_str, to_str, from_str, str, fmt to std::text::* (or anything in between)
    • hashmap, trie, vec, at_vec to container::*
    • at_vec to vec::at_vec (or container as above)
    • ptr, owned, managed, borrow to ptr::* (with the current ptr becoming ptr::raw.)
  • extra:
    • bigint, rational, complex to num::*
    • dlist, list, ringbuf, smallintmap, priority_queue, treemap to container::*
    • sha1, sha2, md5, md4 to crypto::* (or something, I'd feel bad about putting md5/md4 in "crypto")

(I imagine it'd be very easy to get carried away with making it too granular.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions