]> git.lizzy.rs Git - rust.git/blob - src/libcore/core.rc
Remove 'Local Variable' comments
[rust.git] / src / libcore / core.rc
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 /*!
12
13 # The Rust core library
14
15 The Rust core library provides runtime features required by the language,
16 including the task scheduler and memory allocators, as well as library
17 support for Rust built-in types, platform abstractions, and other commonly
18 used features.
19
20 `core` includes modules corresponding to each of the integer types, each of
21 the floating point types, the `bool` type, tuples, characters, strings
22 (`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
23 and unsafe and borrowed pointers (`ptr`).  Additionally, `core` provides
24 pervasive types (`option` and `result`), task creation and communication
25 primitives (`task`, `comm`), platform abstractions (`os` and `path`), basic
26 I/O abstractions (`io`), common traits (`kinds`, `ops`, `cmp`, `num`,
27 `to_str`), and complete bindings to the C standard library (`libc`).
28
29 # Core injection and the Rust prelude
30
31 `core` is imported at the topmost level of every crate by default, as
32 if the first line of each crate was
33
34     extern mod core;
35
36 This means that the contents of core can be accessed from from any context
37 with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
38 etc.
39
40 Additionally, `core` contains a `prelude` module that reexports many of the
41 most common core modules, types and traits. The contents of the prelude are
42 imported into every *module* by default.  Implicitly, all modules behave as if
43 they contained the following prologue:
44
45     use core::prelude::*;
46
47 */
48
49
50 #[link(name = "core",
51        vers = "0.7-pre",
52        uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
53        url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
54
55 #[comment = "The Rust core library"];
56 #[license = "MIT/ASL2"];
57 #[crate_type = "lib"];
58
59
60 // Don't link to core. We are core.
61 #[no_core];
62
63 #[warn(vecs_implicitly_copyable)];
64 #[deny(non_camel_case_types)];
65 #[allow(deprecated_mutable_fields)];
66
67 // Make core testable by not duplicating lang items. See #2912
68 #[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
69 #[cfg(test)] pub use kinds = realcore::kinds;
70 #[cfg(test)] pub use ops = realcore::ops;
71 #[cfg(test)] pub use cmp = realcore::cmp;
72
73 /* Reexported core operators */
74
75 pub use kinds::{Const, Copy, Owned, Durable};
76 pub use ops::{Drop};
77 #[cfg(stage0)]
78 pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
79 #[cfg(not(stage0))]
80 pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
81 pub use ops::{BitAnd, BitOr, BitXor};
82 pub use ops::{Shl, Shr, Index};
83
84
85 /* Reexported types and traits */
86
87 pub use option::{Option, Some, None};
88 pub use result::{Result, Ok, Err};
89
90 pub use path::Path;
91 pub use path::GenericPath;
92 pub use path::WindowsPath;
93 pub use path::PosixPath;
94
95 pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
96 pub use str::{StrSlice};
97 pub use container::{Container, Mutable};
98 pub use vec::{CopyableVector, ImmutableVector};
99 pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
100 pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
101 pub use old_iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
102 pub use old_iter::{CopyableOrderedIter, CopyableNonstrictIter};
103 pub use old_iter::{ExtendedMutableIter};
104 pub use iter::Times;
105
106 pub use num::{Num, NumCast};
107 pub use num::{Orderable, Signed, Unsigned, Round};
108 pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
109 pub use num::{Integer, Fractional, Real, RealExt};
110 pub use num::{Bitwise, BitCount, Bounded};
111 pub use num::{Primitive, Int, Float};
112
113 pub use ptr::Ptr;
114 pub use to_str::ToStr;
115 pub use clone::Clone;
116
117 // On Linux, link to the runtime with -lrt.
118 #[cfg(target_os = "linux")]
119 #[doc(hidden)]
120 pub mod linkhack {
121     #[link_args="-lrustrt -lrt"]
122     #[link_args = "-lpthread"]
123     extern {
124     }
125 }
126
127 /* The Prelude. */
128
129 pub mod prelude;
130
131 /* Primitive types */
132
133 #[path = "num/int-template.rs"] #[merge = "num/int-template/int.rs"]
134 pub mod int;
135 #[path = "num/int-template.rs"] #[merge = "num/int-template/i8.rs"]
136 pub mod i8;
137 #[path = "num/int-template.rs"] #[merge = "num/int-template/i16.rs"]
138 pub mod i16;
139 #[path = "num/int-template.rs"] #[merge = "num/int-template/i32.rs"]
140 pub mod i32;
141 #[path = "num/int-template.rs"] #[merge = "num/int-template/i64.rs"]
142 pub mod i64;
143 #[path = "num/uint-template.rs"] #[merge = "num/uint-template/uint.rs"]
144 pub mod uint;
145
146 #[path = "num/uint-template.rs"] #[merge = "num/uint-template/u8.rs"]
147 pub mod u8;
148 #[path = "num/uint-template.rs"] #[merge = "num/uint-template/u16.rs"]
149 pub mod u16;
150 #[path = "num/uint-template.rs"] #[merge = "num/uint-template/u32.rs"]
151 pub mod u32;
152 #[path = "num/uint-template.rs"] #[merge = "num/uint-template/u64.rs"]
153 pub mod u64;
154
155 #[path = "num/float.rs"]
156 pub mod float;
157 #[path = "num/f32.rs"]
158 pub mod f32;
159 #[path = "num/f64.rs"]
160 pub mod f64;
161
162 pub mod nil;
163 pub mod bool;
164 pub mod char;
165 pub mod tuple;
166
167 pub mod vec;
168 pub mod at_vec;
169 pub mod str;
170
171 #[path = "str/ascii.rs"]
172 pub mod ascii;
173
174 pub mod ptr;
175 pub mod owned;
176 pub mod managed;
177
178
179 /* Core language traits */
180
181 #[cfg(notest)] pub mod kinds;
182 #[cfg(notest)] pub mod ops;
183 #[cfg(notest)] pub mod cmp;
184
185
186 /* Common traits */
187
188 pub mod from_str;
189 #[path = "num/num.rs"]
190 pub mod num;
191 pub mod iter;
192 pub mod old_iter;
193 pub mod iterator;
194 pub mod to_str;
195 pub mod to_bytes;
196 pub mod clone;
197 pub mod io;
198 pub mod hash;
199 pub mod container;
200
201
202 /* Common data structures */
203
204 pub mod option;
205 pub mod result;
206 pub mod either;
207 pub mod hashmap;
208 pub mod cell;
209 pub mod trie;
210
211
212 /* Tasks and communication */
213
214 #[path = "task/mod.rs"]
215 pub mod task;
216 pub mod comm;
217 pub mod pipes;
218
219
220 /* Runtime and platform support */
221
222 pub mod gc;
223 pub mod libc;
224 pub mod os;
225 pub mod path;
226 pub mod rand;
227 pub mod run;
228 pub mod sys;
229 pub mod cast;
230 pub mod flate;
231 pub mod repr;
232 pub mod cleanup;
233 pub mod reflect;
234 pub mod condition;
235 pub mod logging;
236 pub mod util;
237
238
239 /* Unsupported interfaces */
240
241 // Private APIs
242 pub mod unstable;
243
244 /* For internal use, not exported */
245
246 pub mod unicode;
247 #[path = "num/cmath.rs"]
248 pub mod cmath;
249 pub mod stackwalk;
250 #[path = "rt/mod.rs"]
251 pub mod rt;
252
253 // A curious inner-module that's not exported that contains the binding
254 // 'core' so that macro-expanded references to core::error and such
255 // can be resolved within libcore.
256 #[doc(hidden)]
257 mod core {
258     pub use clone;
259     pub use cmp;
260     pub use condition;
261     pub use option;
262     pub use kinds;
263     pub use sys;
264     pub use pipes;
265 }