Module std::preludeStable [-] [+] [src]

The Rust prelude

Because std is required by most serious Rust software, it is imported at the topmost level of every crate by default, as if the first line of each crate was

fn main() { extern crate std; }
extern crate std;

This means that the contents of std can be accessed from any context with the std:: path prefix, as in use std::vec, use std::task::spawn, etc.

Additionally, std contains a prelude module that reexports many of the most common traits, types and functions. The contents of the prelude are imported into every module by default. Implicitly, all modules behave as if they contained the following prologue:

fn main() { use std::prelude::v1::*; }
use std::prelude::v1::*;

The prelude is primarily concerned with exporting traits that are so pervasive that it would be obnoxious to import for every use, particularly those that define methods on primitive types.

Modules

v1

The first version of the prelude of the standard library.