2013-02-28 14:15:32 +01:00
|
|
|
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
2012-12-04 01:48:01 +01:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-09-20 01:52:32 +02:00
|
|
|
/*!
|
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
# The Rust standard library
|
2012-09-20 01:52:32 +02:00
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
The Rust standard library provides runtime features required by the language,
|
2012-09-20 01:52:32 +02:00
|
|
|
including the task scheduler and memory allocators, as well as library
|
|
|
|
support for Rust built-in types, platform abstractions, and other commonly
|
|
|
|
used features.
|
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
`std` includes modules corresponding to each of the integer types, each of
|
2013-03-25 02:38:17 +01:00
|
|
|
the floating point types, the `bool` type, tuples, characters, strings
|
|
|
|
(`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
|
2013-06-14 03:41:11 +02:00
|
|
|
and unsafe and borrowed pointers (`ptr`). Additionally, `std` provides
|
2013-03-25 02:38:17 +01:00
|
|
|
pervasive types (`option` and `result`), task creation and communication
|
|
|
|
primitives (`task`, `comm`), platform abstractions (`os` and `path`), basic
|
|
|
|
I/O abstractions (`io`), common traits (`kinds`, `ops`, `cmp`, `num`,
|
|
|
|
`to_str`), and complete bindings to the C standard library (`libc`).
|
2012-09-20 01:52:32 +02:00
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
# Standard library injection and the Rust prelude
|
2013-03-25 02:38:17 +01:00
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
`std` is imported at the topmost level of every crate by default, as
|
2013-03-25 02:38:17 +01:00
|
|
|
if the first line of each crate was
|
2012-09-20 01:52:32 +02:00
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
extern mod std;
|
2013-03-25 02:38:17 +01:00
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
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`,
|
2013-03-25 02:38:17 +01:00
|
|
|
etc.
|
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
Additionally, `std` contains a `prelude` module that reexports many of the
|
2013-06-17 08:21:49 +02:00
|
|
|
most common `std` modules, types and traits. The contents of the prelude are
|
2013-04-01 21:11:07 +02:00
|
|
|
imported into every *module* by default. Implicitly, all modules behave as if
|
2013-03-25 02:38:17 +01:00
|
|
|
they contained the following prologue:
|
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
use std::prelude::*;
|
2012-09-20 01:52:32 +02:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2013-05-18 00:28:44 +02:00
|
|
|
#[link(name = "std",
|
2013-04-05 06:46:37 +02:00
|
|
|
vers = "0.7-pre",
|
2011-12-06 01:46:37 +01:00
|
|
|
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
|
2013-06-14 03:41:11 +02:00
|
|
|
url = "https://github.com/mozilla/rust/tree/master/src/libstd")];
|
2011-12-06 01:46:37 +01:00
|
|
|
|
2013-06-14 03:41:11 +02:00
|
|
|
#[comment = "The Rust standard library"];
|
2013-03-01 17:41:31 +01:00
|
|
|
#[license = "MIT/ASL2"];
|
2011-12-09 06:08:23 +01:00
|
|
|
#[crate_type = "lib"];
|
2011-12-06 01:46:37 +01:00
|
|
|
|
2013-05-28 23:35:52 +02:00
|
|
|
// NOTE: remove these two attributes after the next snapshot
|
|
|
|
#[no_core]; // for stage0
|
|
|
|
#[allow(unrecognized_lint)]; // otherwise stage0 is seriously ugly
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2013-05-17 22:12:42 +02:00
|
|
|
// Don't link to std. We are std.
|
|
|
|
#[no_std];
|
2012-04-19 10:00:52 +02:00
|
|
|
|
2012-09-09 23:51:56 +02:00
|
|
|
#[deny(non_camel_case_types)];
|
2013-05-28 23:35:52 +02:00
|
|
|
#[deny(missing_doc)];
|
2012-06-05 03:34:24 +02:00
|
|
|
|
2013-06-17 08:21:49 +02:00
|
|
|
// Make std testable by not duplicating lang items. See #2912
|
2013-05-18 00:28:44 +02:00
|
|
|
#[cfg(test)] extern mod realstd(name = "std");
|
|
|
|
#[cfg(test)] pub use kinds = realstd::kinds;
|
|
|
|
#[cfg(test)] pub use ops = realstd::ops;
|
|
|
|
#[cfg(test)] pub use cmp = realstd::cmp;
|
2013-03-27 03:53:33 +01:00
|
|
|
|
2013-03-07 04:09:17 +01:00
|
|
|
// On Linux, link to the runtime with -lrt.
|
|
|
|
#[cfg(target_os = "linux")]
|
2013-03-14 03:12:43 +01:00
|
|
|
#[doc(hidden)]
|
2013-03-07 04:09:17 +01:00
|
|
|
pub mod linkhack {
|
|
|
|
#[link_args="-lrustrt -lrt"]
|
2013-03-09 01:05:50 +01:00
|
|
|
#[link_args = "-lpthread"]
|
2013-03-07 04:09:17 +01:00
|
|
|
extern {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-24 00:11:28 +02:00
|
|
|
// Internal macros
|
|
|
|
mod macros;
|
|
|
|
|
2013-01-09 04:37:25 +01:00
|
|
|
/* The Prelude. */
|
|
|
|
|
|
|
|
pub mod prelude;
|
2011-12-14 01:25:51 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
/* Primitive types */
|
2012-04-15 02:21:10 +02:00
|
|
|
|
2013-05-13 03:14:40 +02:00
|
|
|
#[path = "num/int_macros.rs"] mod int_macros;
|
|
|
|
#[path = "num/uint_macros.rs"] mod uint_macros;
|
|
|
|
|
|
|
|
#[path = "num/int.rs"] pub mod int;
|
|
|
|
#[path = "num/i8.rs"] pub mod i8;
|
|
|
|
#[path = "num/i16.rs"] pub mod i16;
|
|
|
|
#[path = "num/i32.rs"] pub mod i32;
|
|
|
|
#[path = "num/i64.rs"] pub mod i64;
|
|
|
|
|
|
|
|
#[path = "num/uint.rs"] pub mod uint;
|
|
|
|
#[path = "num/u8.rs"] pub mod u8;
|
|
|
|
#[path = "num/u16.rs"] pub mod u16;
|
|
|
|
#[path = "num/u32.rs"] pub mod u32;
|
|
|
|
#[path = "num/u64.rs"] pub mod u64;
|
|
|
|
|
|
|
|
#[path = "num/float.rs"] pub mod float;
|
|
|
|
#[path = "num/f32.rs"] pub mod f32;
|
|
|
|
#[path = "num/f64.rs"] pub mod f64;
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2012-12-04 02:28:19 +01:00
|
|
|
pub mod nil;
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod bool;
|
2012-11-30 09:47:45 +01:00
|
|
|
pub mod char;
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod tuple;
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
pub mod vec;
|
|
|
|
pub mod at_vec;
|
|
|
|
pub mod str;
|
|
|
|
|
2013-04-22 21:42:25 +02:00
|
|
|
#[path = "str/ascii.rs"]
|
|
|
|
pub mod ascii;
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
pub mod ptr;
|
2012-10-25 23:44:26 +02:00
|
|
|
pub mod owned;
|
2013-01-12 06:01:42 +01:00
|
|
|
pub mod managed;
|
2013-06-03 01:16:40 +02:00
|
|
|
pub mod borrow;
|
2011-12-14 01:25:51 +01:00
|
|
|
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
/* Core language traits */
|
|
|
|
|
2013-05-08 13:11:23 +02:00
|
|
|
#[cfg(not(test))] pub mod kinds;
|
|
|
|
#[cfg(not(test))] pub mod ops;
|
|
|
|
#[cfg(not(test))] pub mod cmp;
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Common traits */
|
|
|
|
|
|
|
|
pub mod from_str;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/num.rs"]
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod num;
|
|
|
|
pub mod iter;
|
2013-04-25 02:35:49 +02:00
|
|
|
pub mod old_iter;
|
2013-04-09 16:54:32 +02:00
|
|
|
pub mod iterator;
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod to_str;
|
|
|
|
pub mod to_bytes;
|
2012-11-27 01:12:47 +01:00
|
|
|
pub mod clone;
|
2012-11-30 09:47:45 +01:00
|
|
|
pub mod io;
|
|
|
|
pub mod hash;
|
2013-01-20 19:46:06 +01:00
|
|
|
pub mod container;
|
2012-08-02 01:04:43 +02:00
|
|
|
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
/* Common data structures */
|
|
|
|
|
|
|
|
pub mod option;
|
|
|
|
pub mod result;
|
|
|
|
pub mod either;
|
2013-01-23 16:25:27 +01:00
|
|
|
pub mod hashmap;
|
2013-02-25 22:23:16 +01:00
|
|
|
pub mod cell;
|
2013-03-02 20:41:31 +01:00
|
|
|
pub mod trie;
|
2012-02-22 13:06:38 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/* Tasks and communication */
|
|
|
|
|
2012-11-29 01:20:41 +01:00
|
|
|
#[path = "task/mod.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod task;
|
2013-02-02 12:10:12 +01:00
|
|
|
pub mod comm;
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod pipes;
|
2013-05-08 15:02:21 +02:00
|
|
|
pub mod local_data;
|
2012-02-22 13:06:38 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/* Runtime and platform support */
|
2011-12-14 01:25:51 +01:00
|
|
|
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod gc;
|
|
|
|
pub mod libc;
|
|
|
|
pub mod os;
|
|
|
|
pub mod path;
|
|
|
|
pub mod rand;
|
|
|
|
pub mod run;
|
|
|
|
pub mod sys;
|
|
|
|
pub mod cast;
|
|
|
|
pub mod repr;
|
|
|
|
pub mod cleanup;
|
|
|
|
pub mod reflect;
|
2012-10-18 01:40:18 +02:00
|
|
|
pub mod condition;
|
2012-11-30 09:47:45 +01:00
|
|
|
pub mod logging;
|
|
|
|
pub mod util;
|
2011-12-14 01:25:51 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/* Unsupported interfaces */
|
|
|
|
|
|
|
|
// Private APIs
|
2013-05-10 01:33:41 +02:00
|
|
|
#[path = "unstable/mod.rs"]
|
2013-02-28 04:53:31 +01:00
|
|
|
pub mod unstable;
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/* For internal use, not exported */
|
|
|
|
|
2013-05-03 23:10:32 +02:00
|
|
|
mod unicode;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/cmath.rs"]
|
2013-05-03 23:10:32 +02:00
|
|
|
mod cmath;
|
|
|
|
mod stackwalk;
|
2013-04-28 03:57:15 +02:00
|
|
|
|
|
|
|
// XXX: This shouldn't be pub, and it should be reexported under 'unstable'
|
|
|
|
// but name resolution doesn't work without it being pub.
|
2013-02-04 03:15:43 +01:00
|
|
|
#[path = "rt/mod.rs"]
|
2013-04-28 03:57:15 +02:00
|
|
|
pub mod rt;
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2012-11-28 21:33:00 +01:00
|
|
|
// A curious inner-module that's not exported that contains the binding
|
2013-05-18 00:28:44 +02:00
|
|
|
// 'std' so that macro-expanded references to std::error and such
|
|
|
|
// can be resolved within libstd.
|
2013-03-14 03:12:55 +01:00
|
|
|
#[doc(hidden)]
|
2013-03-27 03:53:33 +01:00
|
|
|
mod core {
|
2013-03-22 20:33:53 +01:00
|
|
|
pub use clone;
|
2012-12-12 00:16:36 +01:00
|
|
|
pub use cmp;
|
2012-12-14 20:52:11 +01:00
|
|
|
pub use condition;
|
2013-03-01 19:44:43 +01:00
|
|
|
pub use option;
|
2013-03-01 21:11:07 +01:00
|
|
|
pub use kinds;
|
2013-02-01 02:51:01 +01:00
|
|
|
pub use sys;
|
2013-02-02 12:10:12 +01:00
|
|
|
pub use pipes;
|
2012-11-28 21:33:00 +01:00
|
|
|
}
|
2013-05-21 00:20:16 +02:00
|
|
|
#[doc(hidden)]
|
|
|
|
mod std {
|
|
|
|
pub use clone;
|
|
|
|
pub use cmp;
|
|
|
|
pub use condition;
|
|
|
|
pub use option;
|
|
|
|
pub use kinds;
|
|
|
|
pub use sys;
|
|
|
|
pub use pipes;
|
2013-05-25 04:35:29 +02:00
|
|
|
pub use unstable;
|
|
|
|
pub use str;
|
|
|
|
pub use os;
|
2013-05-21 00:20:16 +02:00
|
|
|
}
|