Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

Hopefully this will help:

The traits defined in std are listed in the modules that they are defined in, just like all the other kinds of types (structs and enums) defined in std.

The top level modules of std are themselves linked from the main index of std, of course, and you navigate through them to find the types you care about. The primitive types have links on the main index of std because they otherwise wouldn't appear in the API documentation (since they are primitive and thus aren't defined in any module), but most types are not (e.g. HashSet<T> isn't linked from the main index). The macros have links on the main index of std because they aren't imported using the module system.

What you're probably refering to though are the traits re-exported by the std prelude, which are automatically imported into every Rust module. The prelude is described on this page (linked to from the std main index):

https://doc.rust-lang.org/nightly/std/prelude/

The prelude mostly imports traits, but it also imports a few other kinds of items as well: some types (like Option<T> and String) and at least one function (drop()).

But what traits your type should implement is not really connected with what traits are imported in the prelude.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: