]> git.lizzy.rs Git - rust.git/blob - src/libcore/lib.rs
2ff2dca0c867300fa1f0182b642495167fd005f2
[rust.git] / src / libcore / lib.rs
1 // Copyright 2014 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 Core Library
12 //!
13 //! The Rust Core Library is the dependency-free foundation of [The
14 //! Rust Standard Library](../std/index.html). It is the portable glue
15 //! between the language and its libraries, defining the intrinsic and
16 //! primitive building blocks of all Rust code. It links to no
17 //! upstream libraries, no system libraries, and no libc.
18 //!
19 //! The core library is *minimal*: it isn't even aware of heap allocation,
20 //! nor does it provide concurrency or I/O. These things require
21 //! platform integration, and this library is platform-agnostic.
22 //!
23 //! *It is not recommended to use the core library*. The stable
24 //! functionality of libcore is reexported from the
25 //! [standard library](../std/index.html). The composition of this library is
26 //! subject to change over time; only the interface exposed through libstd is
27 //! intended to be stable.
28 //!
29 //! # How to use the core library
30 //!
31 // FIXME: Fill me in with more detail when the interface settles
32 //! This library is built on the assumption of a few existing symbols:
33 //!
34 //! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are
35 //!   often generated by LLVM. Additionally, this library can make explicit
36 //!   calls to these functions. Their signatures are the same as found in C.
37 //!   These functions are often provided by the system libc, but can also be
38 //!   provided by `librlibc` which is distributed with the standard rust
39 //!   distribution.
40 //!
41 //! * `rust_begin_unwind` - This function takes three arguments, a
42 //!   `&fmt::Arguments`, a `&str`, and a `uint`. These three arguments dictate
43 //!   the failure message, the file at which failure was invoked, and the line.
44 //!   It is up to consumers of this core library to define this failure
45 //!   function; it is only required to never return.
46 //!
47
48 #![crate_id = "core#0.11.0-pre"]
49 #![license = "MIT/ASL2"]
50 #![crate_type = "rlib"]
51 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
52        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
53        html_root_url = "http://doc.rust-lang.org/")]
54
55 #![no_std]
56 #![feature(globs, macro_rules, managed_boxes, phase, simd)]
57 #![deny(missing_doc)]
58
59 #[cfg(test)] extern crate realcore = "core";
60 #[cfg(test)] extern crate libc;
61 #[cfg(test)] extern crate native;
62 #[cfg(test)] extern crate realstd = "std";
63
64 #[cfg(test)] pub use cmp = realcore::cmp;
65 #[cfg(test)] pub use kinds = realcore::kinds;
66 #[cfg(test)] pub use ops = realcore::ops;
67 #[cfg(test)] pub use ty = realcore::ty;
68
69 mod macros;
70
71 #[path = "num/float_macros.rs"] mod float_macros;
72 #[path = "num/int_macros.rs"]   mod int_macros;
73 #[path = "num/uint_macros.rs"]  mod uint_macros;
74
75 #[path = "num/int.rs"]  pub mod int;
76 #[path = "num/i8.rs"]   pub mod i8;
77 #[path = "num/i16.rs"]  pub mod i16;
78 #[path = "num/i32.rs"]  pub mod i32;
79 #[path = "num/i64.rs"]  pub mod i64;
80
81 #[path = "num/uint.rs"] pub mod uint;
82 #[path = "num/u8.rs"]   pub mod u8;
83 #[path = "num/u16.rs"]  pub mod u16;
84 #[path = "num/u32.rs"]  pub mod u32;
85 #[path = "num/u64.rs"]  pub mod u64;
86
87 #[path = "num/f32.rs"]   pub mod f32;
88 #[path = "num/f64.rs"]   pub mod f64;
89
90 pub mod num;
91
92 /* The libcore prelude, not as all-encompassing as the libstd prelude */
93
94 pub mod prelude;
95
96 /* Core modules for ownership management */
97
98 pub mod intrinsics;
99 pub mod mem;
100 pub mod ptr;
101
102 /* Core language traits */
103
104 #[cfg(not(test))] pub mod kinds;
105 #[cfg(not(test))] pub mod ops;
106 #[cfg(not(test))] pub mod ty;
107 #[cfg(not(test))] pub mod cmp;
108 pub mod clone;
109 pub mod default;
110 pub mod container;
111
112 /* Core types and methods on primitives */
113
114 mod unicode;
115 pub mod any;
116 pub mod atomics;
117 pub mod bool;
118 pub mod cell;
119 pub mod char;
120 pub mod failure;
121 pub mod finally;
122 pub mod iter;
123 pub mod option;
124 pub mod raw;
125 pub mod result;
126 pub mod simd;
127 pub mod slice;
128 pub mod str;
129 pub mod tuple;
130 pub mod fmt;
131
132 // FIXME: this module should not exist. Once owned allocations are no longer a
133 //        language type, this module can move outside to the owned allocation
134 //        crate.
135 mod should_not_exist;
136
137 mod core {
138     pub use failure;
139 }
140
141 mod std {
142     pub use clone;
143     pub use cmp;
144     pub use kinds;
145     pub use option;
146     pub use fmt;
147
148     #[cfg(test)] pub use realstd::rt;     // needed for fail!()
149     // #[cfg(test)] pub use realstd::option; // needed for fail!()
150     // #[cfg(test)] pub use realstd::fmt;    // needed for fail!()
151     #[cfg(test)] pub use realstd::os;     // needed for tests
152     #[cfg(test)] pub use realstd::slice;  // needed for tests
153     #[cfg(test)] pub use realstd::vec;    // needed for vec![]
154 }