Prelude

A prelude is a module that is intended for importing all items in it, using a glob import. For example:

This makes all items in the prelude available.

The Rust prelude
The standard library has a special prelude, which is imported automatically in every Rust file. It is located in and contains the following items:


 * Traits:
 * Marker traits:, , , ,
 * Function traits:, ,
 * Iterator traits:, , , ,
 * Comparison traits:, , ,
 * Conversion traits:, , ,
 * Other traits:, , , ,
 * Structs:, ,
 * Enums and enum variants:
 * Functions:
 * Macros:
 * Built-in macros:,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,
 * Attribute macros:,  ,  ,
 * Derive macros:,  ,  ,  ,  ,  ,  ,  ,  ,  ,
 * Attribute macros:,  ,  ,
 * Derive macros:,  ,  ,  ,  ,  ,  ,  ,  ,  ,

In crates, the core prelude is used instead, which is a subset of the prelude in. There is also an experimental alloc prelude to complement the core prelude. This one is not imported automatically, however.

Note that primitive types are always in scope, so they don't need to be imported.

Other preludes
Any crate can define a prelude. However, these preludes must be imported manually. For example, the standard library contains the following preludes, besides the ones already mentioned: