Prelude

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

use std::io::prelude::*;

This makes all items in the prelude available.

The Rust preludeEdit

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

In #![no_std] crates, the core prelude is used instead, which is a subset of the prelude in std. 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 preludesEdit

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: