2013-02-28 07:15:32 -06:00
|
|
|
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
2012-12-03 18:48:01 -06: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-19 18:52:32 -05:00
|
|
|
/*!
|
|
|
|
|
2013-03-24 20:38:17 -05:00
|
|
|
# The Rust core library
|
2012-09-19 18:52:32 -05:00
|
|
|
|
|
|
|
The Rust core library provides runtime features required by the language,
|
|
|
|
including the task scheduler and memory allocators, as well as library
|
|
|
|
support for Rust built-in types, platform abstractions, and other commonly
|
|
|
|
used features.
|
|
|
|
|
|
|
|
`core` includes modules corresponding to each of the integer types, each of
|
2013-03-24 20:38:17 -05:00
|
|
|
the floating point types, the `bool` type, tuples, characters, strings
|
|
|
|
(`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
|
|
|
|
and unsafe and borrowed pointers (`ptr`). Additionally, `core` provides
|
|
|
|
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-19 18:52:32 -05:00
|
|
|
|
2013-03-24 20:38:17 -05:00
|
|
|
# Core injection and the Rust prelude
|
|
|
|
|
|
|
|
`core` is imported at the topmost level of every crate by default, as
|
|
|
|
if the first line of each crate was
|
2012-09-19 18:52:32 -05:00
|
|
|
|
|
|
|
extern mod core;
|
2013-03-24 20:38:17 -05:00
|
|
|
|
|
|
|
This means that the contents of core can be accessed from from any context
|
|
|
|
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
|
|
|
|
etc.
|
|
|
|
|
|
|
|
Additionally, `core` contains a `prelude` module that reexports many of the
|
|
|
|
most common core modules, types and traits. The contents of the prelude are
|
2013-04-01 14:11:07 -05:00
|
|
|
imported into every *module* by default. Implicitly, all modules behave as if
|
2013-03-24 20:38:17 -05:00
|
|
|
they contained the following prologue:
|
|
|
|
|
|
|
|
use core::prelude::*;
|
2012-09-19 18:52:32 -05:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
|
2011-12-05 18:46:37 -06:00
|
|
|
#[link(name = "core",
|
2013-04-04 23:46:37 -05:00
|
|
|
vers = "0.7-pre",
|
2011-12-05 18:46:37 -06:00
|
|
|
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
|
2012-03-28 15:42:17 -05:00
|
|
|
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
|
2011-12-05 18:46:37 -06:00
|
|
|
|
|
|
|
#[comment = "The Rust core library"];
|
2013-03-01 10:41:31 -06:00
|
|
|
#[license = "MIT/ASL2"];
|
2011-12-08 23:08:23 -06:00
|
|
|
#[crate_type = "lib"];
|
2011-12-05 18:46:37 -06:00
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
|
2012-04-19 03:00:52 -05:00
|
|
|
// Don't link to core. We are core.
|
|
|
|
#[no_core];
|
|
|
|
|
2012-09-02 18:21:57 -05:00
|
|
|
#[warn(vecs_implicitly_copyable)];
|
2012-09-09 16:51:56 -05:00
|
|
|
#[deny(non_camel_case_types)];
|
2013-02-25 13:34:16 -06:00
|
|
|
#[allow(deprecated_mutable_fields)];
|
2013-03-08 18:21:58 -06:00
|
|
|
#[allow(deprecated_drop)];
|
2012-06-04 20:34:24 -05:00
|
|
|
|
2013-03-26 21:53:33 -05:00
|
|
|
// Make core testable by not duplicating lang items. See #2912
|
2013-04-04 23:46:37 -05:00
|
|
|
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
|
2013-03-26 21:53:33 -05:00
|
|
|
#[cfg(test)] pub use kinds = realcore::kinds;
|
|
|
|
#[cfg(test)] pub use ops = realcore::ops;
|
|
|
|
#[cfg(test)] pub use cmp = realcore::cmp;
|
|
|
|
|
|
|
|
/* Reexported core operators */
|
|
|
|
|
|
|
|
pub use kinds::{Const, Copy, Owned, Durable};
|
|
|
|
pub use ops::{Drop};
|
2013-04-21 10:58:53 -05:00
|
|
|
#[cfg(stage0)]
|
2013-03-26 21:53:33 -05:00
|
|
|
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
|
2013-04-24 07:26:14 -05:00
|
|
|
#[cfg(not(stage0))]
|
2013-04-21 10:58:53 -05:00
|
|
|
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
|
2013-03-26 21:53:33 -05:00
|
|
|
pub use ops::{BitAnd, BitOr, BitXor};
|
|
|
|
pub use ops::{Shl, Shr, Index};
|
|
|
|
|
|
|
|
|
|
|
|
/* Reexported types and traits */
|
|
|
|
|
|
|
|
pub use option::{Option, Some, None};
|
|
|
|
pub use result::{Result, Ok, Err};
|
|
|
|
|
|
|
|
pub use path::Path;
|
|
|
|
pub use path::GenericPath;
|
|
|
|
pub use path::WindowsPath;
|
|
|
|
pub use path::PosixPath;
|
|
|
|
|
|
|
|
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
|
|
|
|
pub use str::{StrSlice};
|
|
|
|
pub use container::{Container, Mutable};
|
|
|
|
pub use vec::{CopyableVector, ImmutableVector};
|
|
|
|
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
|
2013-04-18 17:53:29 -05:00
|
|
|
pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
|
2013-03-26 21:53:33 -05:00
|
|
|
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
|
|
|
|
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
|
2013-04-16 18:11:16 -05:00
|
|
|
pub use iter::{ExtendedMutableIter};
|
2013-03-26 21:53:33 -05:00
|
|
|
|
2013-04-24 07:45:57 -05:00
|
|
|
pub use num::{Num, NumCast};
|
|
|
|
pub use num::{Signed, Unsigned, Integer};
|
2013-04-24 20:53:04 -05:00
|
|
|
pub use num::{Round, Fractional, Real, RealExt};
|
2013-04-25 19:02:00 -05:00
|
|
|
pub use num::{Bitwise, Bounded};
|
|
|
|
pub use num::{Primitive, PrimitiveInt};
|
2013-03-26 21:53:33 -05:00
|
|
|
pub use ptr::Ptr;
|
|
|
|
pub use to_str::ToStr;
|
|
|
|
pub use clone::Clone;
|
|
|
|
|
2013-03-06 21:09:17 -06:00
|
|
|
// On Linux, link to the runtime with -lrt.
|
|
|
|
#[cfg(target_os = "linux")]
|
2013-03-13 21:12:43 -05:00
|
|
|
#[doc(hidden)]
|
2013-03-06 21:09:17 -06:00
|
|
|
pub mod linkhack {
|
|
|
|
#[link_args="-lrustrt -lrt"]
|
2013-03-08 18:05:50 -06:00
|
|
|
#[link_args = "-lpthread"]
|
2013-03-06 21:09:17 -06:00
|
|
|
extern {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-08 21:37:25 -06:00
|
|
|
/* The Prelude. */
|
|
|
|
|
|
|
|
pub mod prelude;
|
2011-12-13 18:25:51 -06:00
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
/* Primitive types */
|
2012-04-14 19:21:10 -05:00
|
|
|
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/int.rs"]
|
2012-11-30 02:47:45 -06:00
|
|
|
pub mod int;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i8.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod i8;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i16.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod i16;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i32.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod i32;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i64.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod i64;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/uint.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod uint;
|
2012-04-15 00:07:45 -05:00
|
|
|
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u8.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod u8;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u16.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod u16;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u32.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod u32;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u64.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod u64;
|
2012-04-15 00:07:45 -05:00
|
|
|
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/float.rs"]
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod float;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/f32.rs"]
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod f32;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/f64.rs"]
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod f64;
|
2012-11-30 02:47:45 -06:00
|
|
|
|
2012-12-03 19:28:19 -06:00
|
|
|
pub mod nil;
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod bool;
|
2012-11-30 02:47:45 -06:00
|
|
|
pub mod char;
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod tuple;
|
2012-11-30 02:47:45 -06:00
|
|
|
|
|
|
|
pub mod vec;
|
|
|
|
pub mod at_vec;
|
|
|
|
pub mod str;
|
|
|
|
|
2013-04-22 14:42:25 -05:00
|
|
|
#[path = "str/ascii.rs"]
|
|
|
|
pub mod ascii;
|
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
pub mod ptr;
|
2012-10-25 16:44:26 -05:00
|
|
|
pub mod owned;
|
2013-01-11 23:01:42 -06:00
|
|
|
pub mod managed;
|
2011-12-13 18:25:51 -06:00
|
|
|
|
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
/* Core language traits */
|
|
|
|
|
|
|
|
#[cfg(notest)] pub mod kinds;
|
|
|
|
#[cfg(notest)] pub mod ops;
|
|
|
|
#[cfg(notest)] pub mod cmp;
|
|
|
|
|
|
|
|
|
|
|
|
/* Common traits */
|
|
|
|
|
|
|
|
pub mod from_str;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/num.rs"]
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod num;
|
|
|
|
pub mod iter;
|
2013-04-09 09:54:32 -05:00
|
|
|
pub mod iterator;
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod to_str;
|
|
|
|
pub mod to_bytes;
|
2012-11-26 18:12:47 -06:00
|
|
|
pub mod clone;
|
2012-11-30 02:47:45 -06:00
|
|
|
pub mod io;
|
|
|
|
pub mod hash;
|
2013-01-20 12:46:06 -06:00
|
|
|
pub mod container;
|
2012-08-01 18:04:43 -05:00
|
|
|
|
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
/* Common data structures */
|
|
|
|
|
|
|
|
pub mod option;
|
|
|
|
pub mod result;
|
|
|
|
pub mod either;
|
2013-01-23 09:25:27 -06:00
|
|
|
pub mod hashmap;
|
2013-02-25 15:23:16 -06:00
|
|
|
pub mod cell;
|
2013-03-02 13:41:31 -06:00
|
|
|
pub mod trie;
|
2012-02-22 06:06:38 -06:00
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
|
|
|
|
/* Tasks and communication */
|
|
|
|
|
2012-11-28 18:20:41 -06:00
|
|
|
#[path = "task/mod.rs"]
|
2012-11-28 14:33:00 -06:00
|
|
|
pub mod task;
|
2013-02-02 05:10:12 -06:00
|
|
|
pub mod comm;
|
2012-10-03 21:24:06 -05:00
|
|
|
pub mod pipes;
|
2012-02-22 06:06:38 -06:00
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
|
|
|
|
/* Runtime and platform support */
|
2011-12-13 18:25:51 -06:00
|
|
|
|
2012-10-03 21:24:06 -05: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 flate;
|
|
|
|
pub mod repr;
|
|
|
|
pub mod cleanup;
|
|
|
|
pub mod reflect;
|
2012-10-17 18:40:18 -05:00
|
|
|
pub mod condition;
|
2012-11-30 02:47:45 -06:00
|
|
|
pub mod logging;
|
|
|
|
pub mod util;
|
2011-12-13 18:25:51 -06:00
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
|
|
|
|
/* Unsupported interfaces */
|
|
|
|
|
|
|
|
// Private APIs
|
2013-02-27 21:53:31 -06:00
|
|
|
pub mod unstable;
|
2012-11-30 02:47:45 -06:00
|
|
|
|
|
|
|
/* For internal use, not exported */
|
|
|
|
|
2013-03-01 12:44:43 -06:00
|
|
|
pub mod unicode;
|
2013-01-19 15:41:25 -06:00
|
|
|
#[path = "num/cmath.rs"]
|
2013-03-01 12:44:43 -06:00
|
|
|
pub mod cmath;
|
|
|
|
pub mod stackwalk;
|
2013-02-03 20:15:43 -06:00
|
|
|
#[path = "rt/mod.rs"]
|
|
|
|
pub mod rt;
|
2012-11-30 02:47:45 -06:00
|
|
|
|
2012-11-28 14:33:00 -06:00
|
|
|
// A curious inner-module that's not exported that contains the binding
|
|
|
|
// 'core' so that macro-expanded references to core::error and such
|
|
|
|
// can be resolved within libcore.
|
2013-03-13 21:12:55 -05:00
|
|
|
#[doc(hidden)]
|
2013-03-26 21:53:33 -05:00
|
|
|
mod core {
|
2013-03-22 14:33:53 -05:00
|
|
|
pub use clone;
|
2012-12-11 17:16:36 -06:00
|
|
|
pub use cmp;
|
2012-12-14 13:52:11 -06:00
|
|
|
pub use condition;
|
2013-03-01 12:44:43 -06:00
|
|
|
pub use option;
|
2013-03-01 14:11:07 -06:00
|
|
|
pub use kinds;
|
2013-01-31 19:51:01 -06:00
|
|
|
pub use sys;
|
2013-02-02 05:10:12 -06:00
|
|
|
pub use pipes;
|
2012-11-28 14:33:00 -06:00
|
|
|
}
|
|
|
|
|
2012-11-30 02:47:45 -06:00
|
|
|
|
2011-12-05 18:46:37 -06:00
|
|
|
// Local Variables:
|
|
|
|
// mode: rust;
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
|
|
|
// End:
|