]> git.lizzy.rs Git - rust.git/blob - src/libstd/lib.rs
rename Strong -> Rc, replacing `rc` with `weak`
[rust.git] / src / libstd / lib.rs
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.
4 //
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.
10
11 //! # The Rust standard library
12 //!
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.
17 //!
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 pointers and references (`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`).
27 //!
28 //! # Standard library injection and the Rust prelude
29 //!
30 //! `std` is imported at the topmost level of every crate by default, as
31 //! if the first line of each crate was
32 //!
33 //!     extern mod std;
34 //!
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`,
37 //! etc.
38 //!
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:
43 //!
44 //!     use std::prelude::*;
45
46 #[crate_id = "std#0.9"];
47 #[comment = "The Rust standard library"];
48 #[license = "MIT/ASL2"];
49 #[crate_type = "rlib"];
50 #[crate_type = "dylib"];
51 #[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
52       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
53       html_root_url = "http://static.rust-lang.org/doc/master")];
54
55 #[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args)];
56
57 // Don't link to std. We are std.
58 #[no_std];
59
60 #[deny(non_camel_case_types)];
61 #[deny(missing_doc)];
62
63 // When testing libstd, bring in libuv as the I/O backend so tests can print
64 // things and all of the std::io tests have an I/O interface to run on top
65 // of
66 #[cfg(test)] extern mod rustuv = "rustuv";
67 #[cfg(test)] extern mod native = "native";
68 #[cfg(test)] extern mod green = "green";
69
70 // Make extra accessible for benchmarking
71 #[cfg(test)] extern mod extra = "extra";
72
73 // Make std testable by not duplicating lang items. See #2912
74 #[cfg(test)] extern mod realstd = "std";
75 #[cfg(test)] pub use kinds = realstd::kinds;
76 #[cfg(test)] pub use ops = realstd::ops;
77 #[cfg(test)] pub use cmp = realstd::cmp;
78
79 mod rtdeps;
80
81 /* The Prelude. */
82
83 pub mod prelude;
84
85
86 /* Primitive types */
87
88 #[path = "num/float_macros.rs"] mod float_macros;
89 #[path = "num/int_macros.rs"]   mod int_macros;
90 #[path = "num/uint_macros.rs"]  mod uint_macros;
91
92 #[path = "num/int.rs"]  pub mod int;
93 #[path = "num/i8.rs"]   pub mod i8;
94 #[path = "num/i16.rs"]  pub mod i16;
95 #[path = "num/i32.rs"]  pub mod i32;
96 #[path = "num/i64.rs"]  pub mod i64;
97
98 #[path = "num/uint.rs"] pub mod uint;
99 #[path = "num/u8.rs"]   pub mod u8;
100 #[path = "num/u16.rs"]  pub mod u16;
101 #[path = "num/u32.rs"]  pub mod u32;
102 #[path = "num/u64.rs"]  pub mod u64;
103
104 #[path = "num/f32.rs"]   pub mod f32;
105 #[path = "num/f64.rs"]   pub mod f64;
106
107 pub mod unit;
108 pub mod bool;
109 pub mod char;
110 pub mod tuple;
111
112 pub mod vec;
113 pub mod at_vec;
114 pub mod str;
115
116 pub mod ascii;
117 pub mod send_str;
118
119 pub mod ptr;
120 pub mod owned;
121 pub mod managed;
122 pub mod borrow;
123 pub mod rc;
124 pub mod gc;
125
126
127 /* Core language traits */
128
129 #[cfg(not(test))] pub mod kinds;
130 #[cfg(not(test))] pub mod ops;
131 #[cfg(not(test))] pub mod cmp;
132
133
134 /* Common traits */
135
136 pub mod from_str;
137 pub mod num;
138 pub mod iter;
139 pub mod to_str;
140 pub mod to_bytes;
141 pub mod clone;
142 pub mod hash;
143 pub mod container;
144 pub mod default;
145 pub mod any;
146
147
148 /* Common data structures */
149
150 pub mod option;
151 pub mod result;
152 pub mod hashmap;
153 pub mod cell;
154 pub mod trie;
155
156
157 /* Tasks and communication */
158
159 pub mod task;
160 pub mod comm;
161 pub mod local_data;
162 pub mod sync;
163
164
165 /* Runtime and platform support */
166
167 #[unstable]
168 pub mod libc;
169 pub mod c_str;
170 pub mod os;
171 pub mod io;
172 pub mod path;
173 pub mod rand;
174 pub mod run;
175 pub mod cast;
176 pub mod fmt;
177 pub mod cleanup;
178 #[deprecated]
179 pub mod condition;
180 pub mod logging;
181 pub mod util;
182 pub mod mem;
183
184
185 /* Unsupported interfaces */
186
187 #[unstable]
188 pub mod repr;
189 #[unstable]
190 pub mod reflect;
191
192 // Private APIs
193 #[unstable]
194 pub mod unstable;
195
196
197 /* For internal use, not exported */
198
199 mod unicode;
200 #[path = "num/cmath.rs"]
201 mod cmath;
202
203 // FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable'
204 // but name resolution doesn't work without it being pub.
205 #[unstable]
206 pub mod rt;
207
208 // A curious inner-module that's not exported that contains the binding
209 // 'std' so that macro-expanded references to std::error and such
210 // can be resolved within libstd.
211 #[doc(hidden)]
212 mod std {
213     pub use clone;
214     pub use cmp;
215     pub use comm;
216     pub use condition;
217     pub use fmt;
218     pub use io;
219     pub use kinds;
220     pub use local_data;
221     pub use logging;
222     pub use logging;
223     pub use option;
224     pub use os;
225     pub use rt;
226     pub use str;
227     pub use to_bytes;
228     pub use to_str;
229     pub use unstable;
230 }