1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! # The Rust standard library
13 //! The Rust standard library is a group of interrelated modules defining
14 //! the core language traits, operations on built-in data types, collections,
15 //! platform abstractions, the task scheduler, runtime support for language
16 //! features and other common functionality.
18 //! `std` includes modules corresponding to each of the integer types,
19 //! each of the floating point types, the `bool` type, tuples, characters,
20 //! strings (`str`), vectors (`vec`), managed boxes (`managed`), owned
21 //! boxes (`owned`), and unsafe and borrowed pointers (`ptr`, `borrowed`).
22 //! Additionally, `std` provides pervasive types (`option` and `result`),
23 //! task creation and communication primitives (`task`, `comm`), platform
24 //! abstractions (`os` and `path`), basic I/O abstractions (`io`), common
25 //! traits (`kinds`, `ops`, `cmp`, `num`, `to_str`), and complete bindings
26 //! to the C standard library (`libc`).
28 //! # Standard library injection and the Rust prelude
30 //! `std` is imported at the topmost level of every crate by default, as
31 //! if the first line of each crate was
35 //! This means that the contents of std can be accessed from any context
36 //! with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
39 //! Additionally, `std` contains a `prelude` module that reexports many of the
40 //! most common types, traits and functions. The contents of the prelude are
41 //! imported into every *module* by default. Implicitly, all modules behave as if
42 //! they contained the following prologue:
44 //! use std::prelude::*;
49 uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
50 url = "https://github.com/mozilla/rust/tree/master/src/libstd")];
52 #[comment = "The Rust standard library"];
53 #[license = "MIT/ASL2"];
54 #[crate_type = "lib"]; // NOTE: remove after stage0 snapshot
55 #[crate_type = "rlib"];
56 #[crate_type = "dylib"];
58 #[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
59 html_favicon_url = "http://www.rust-lang.org/favicon.ico",
60 html_root_url = "http://static.rust-lang.org/doc/master")];
62 #[feature(macro_rules, globs, asm, managed_boxes, thread_local)];
64 // Don't link to std. We are std.
67 #[deny(non_camel_case_types)];
70 // When testing libstd, bring in libuv as the I/O backend so tests can print
71 // things and all of the std::io tests have an I/O interface to run on top
73 #[cfg(test)] extern mod rustuv(vers = "0.9-pre");
75 // Make extra accessible for benchmarking
76 #[cfg(test)] extern mod extra(vers = "0.9-pre");
78 // Make std testable by not duplicating lang items. See #2912
79 #[cfg(test)] extern mod realstd(name = "std");
80 #[cfg(test)] pub use kinds = realstd::kinds;
81 #[cfg(test)] pub use ops = realstd::ops;
82 #[cfg(test)] pub use cmp = realstd::cmp;
93 #[path = "num/int_macros.rs"] mod int_macros;
94 #[path = "num/uint_macros.rs"] mod uint_macros;
96 #[path = "num/int.rs"] pub mod int;
97 #[path = "num/i8.rs"] pub mod i8;
98 #[path = "num/i16.rs"] pub mod i16;
99 #[path = "num/i32.rs"] pub mod i32;
100 #[path = "num/i64.rs"] pub mod i64;
102 #[path = "num/uint.rs"] pub mod uint;
103 #[path = "num/u8.rs"] pub mod u8;
104 #[path = "num/u16.rs"] pub mod u16;
105 #[path = "num/u32.rs"] pub mod u32;
106 #[path = "num/u64.rs"] pub mod u64;
108 #[path = "num/f32.rs"] pub mod f32;
109 #[path = "num/f64.rs"] pub mod f64;
131 /* Core language traits */
133 #[cfg(not(test))] pub mod kinds;
134 #[cfg(not(test))] pub mod ops;
135 #[cfg(not(test))] pub mod cmp;
152 /* Common data structures */
162 /* Tasks and communication */
170 /* Runtime and platform support */
190 /* Unsupported interfaces */
196 /* For internal use, not exported */
199 #[path = "num/cmath.rs"]
202 // FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable'
203 // but name resolution doesn't work without it being pub.
206 // A curious inner-module that's not exported that contains the binding
207 // 'std' so that macro-expanded references to std::error and such
208 // can be resolved within libstd.