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
|
|
|
/*!
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
The Rust core library
|
2012-09-20 01:52:32 +02: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
|
|
|
|
the floating point types, the `bool` type, tuples, characters, strings,
|
2012-12-04 02:45:19 +01:00
|
|
|
vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`), and unsafe
|
|
|
|
and borrowed pointers (`ptr`). Additionally, `core` provides task management
|
2013-03-08 03:51:04 +01:00
|
|
|
and creation (`task`), communication primitives (`comm` and `pipes`), platform
|
|
|
|
abstractions (`os` and `path`), basic I/O abstractions (`io`), common traits
|
|
|
|
(`cmp`, `num`, `to_str`), and complete bindings to the C standard library
|
|
|
|
(`libc`).
|
2012-09-20 01:52:32 +02:00
|
|
|
|
2012-09-20 02:17:00 +02:00
|
|
|
`core` is linked to all crates by default and its contents imported.
|
|
|
|
Implicitly, all crates behave as if they included the following prologue:
|
2012-09-20 01:52:32 +02:00
|
|
|
|
|
|
|
extern mod core;
|
|
|
|
use core::*;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2011-12-06 01:46:37 +01:00
|
|
|
#[link(name = "core",
|
2012-12-22 00:35:15 +01:00
|
|
|
vers = "0.6",
|
2011-12-06 01:46:37 +01:00
|
|
|
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
|
2012-03-28 22:42:17 +02:00
|
|
|
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
|
2011-12-06 01:46:37 +01:00
|
|
|
|
|
|
|
#[comment = "The Rust core 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
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2012-04-19 10:00:52 +02:00
|
|
|
// Don't link to core. We are core.
|
|
|
|
#[no_core];
|
|
|
|
|
2012-09-03 01:21:57 +02:00
|
|
|
#[warn(vecs_implicitly_copyable)];
|
2012-09-09 23:51:56 +02:00
|
|
|
#[deny(non_camel_case_types)];
|
2013-02-25 20:34:16 +01:00
|
|
|
#[allow(deprecated_mutable_fields)];
|
2013-03-09 01:34:39 +01:00
|
|
|
#[deny(deprecated_self)];
|
2013-03-09 01:21:58 +01:00
|
|
|
#[allow(deprecated_drop)];
|
2012-06-05 03:34:24 +02:00
|
|
|
|
2013-03-07 04:09:17 +01:00
|
|
|
// On Linux, link to the runtime with -lrt.
|
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
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-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-01-19 22:41:25 +01:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/int.rs"]
|
2012-11-30 09:47:45 +01:00
|
|
|
pub mod int;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i8.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod i8;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i16.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod i16;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i32.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod i32;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/int-template.rs"] #[merge = "num/int-template/i64.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod i64;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/uint.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod uint;
|
2012-04-15 07:07:45 +02:00
|
|
|
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u8.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod u8;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u16.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod u16;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u32.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod u32;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u64.rs"]
|
2012-11-28 21:33:00 +01:00
|
|
|
pub mod u64;
|
2012-04-15 07:07:45 +02:00
|
|
|
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/float.rs"]
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod float;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/f32.rs"]
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod f32;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/f64.rs"]
|
2012-10-04 04:24:06 +02:00
|
|
|
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;
|
|
|
|
|
|
|
|
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;
|
2011-12-14 01:25:51 +01:00
|
|
|
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
/* Core language traits */
|
|
|
|
|
|
|
|
#[cfg(notest)] pub mod kinds;
|
|
|
|
#[cfg(notest)] pub mod ops;
|
|
|
|
#[cfg(notest)] pub mod cmp;
|
|
|
|
|
|
|
|
// Make core testable by not duplicating lang items. See #2912
|
2012-12-22 00:35:15 +01:00
|
|
|
#[cfg(test)] extern mod realcore(name = "core", vers = "0.6");
|
2012-11-30 09:47:45 +01:00
|
|
|
#[cfg(test)] pub use kinds = realcore::kinds;
|
|
|
|
#[cfg(test)] pub use ops = realcore::ops;
|
|
|
|
#[cfg(test)] pub use cmp = realcore::cmp;
|
|
|
|
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
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;
|
2012-10-04 04:24:06 +02:00
|
|
|
pub mod dlist;
|
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;
|
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 mutable;
|
|
|
|
pub mod flate;
|
|
|
|
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
|
|
|
/* Reexported core operators */
|
2012-10-05 00:54:50 +02:00
|
|
|
|
2012-12-11 22:50:04 +01:00
|
|
|
pub use kinds::{Const, Copy, Owned, Durable};
|
2012-11-30 09:47:45 +01:00
|
|
|
pub use ops::{Drop};
|
2013-01-11 18:16:58 +01:00
|
|
|
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
|
2012-11-30 09:47:45 +01:00
|
|
|
pub use ops::{BitAnd, BitOr, BitXor};
|
|
|
|
pub use ops::{Shl, Shr, Index};
|
2012-04-19 10:00:52 +02:00
|
|
|
|
2012-11-28 21:33:00 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
/* Reexported types and traits */
|
2012-11-28 21:33:00 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
pub use option::{Option, Some, None};
|
2012-11-28 21:33:00 +01:00
|
|
|
pub use result::{Result, Ok, Err};
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
pub use path::Path;
|
|
|
|
pub use path::GenericPath;
|
|
|
|
pub use path::WindowsPath;
|
|
|
|
pub use path::PosixPath;
|
2012-11-28 21:33:00 +01:00
|
|
|
|
|
|
|
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
|
|
|
|
pub use str::{StrSlice, Trimmable};
|
2013-01-25 05:08:16 +01:00
|
|
|
pub use container::{Container, Mutable};
|
2013-01-25 04:19:44 +01:00
|
|
|
pub use vec::{CopyableVector, ImmutableVector};
|
2012-11-28 21:33:00 +01:00
|
|
|
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
|
2013-01-07 17:38:24 +01:00
|
|
|
pub use vec::{OwnedVector, OwnedCopyableVector};
|
2012-11-28 21:33:00 +01:00
|
|
|
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
|
|
|
|
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2013-02-13 02:07:26 +01:00
|
|
|
pub use num::NumCast;
|
2012-11-28 21:33:00 +01:00
|
|
|
pub use ptr::Ptr;
|
|
|
|
pub use to_str::ToStr;
|
2012-11-28 21:38:53 +01:00
|
|
|
pub use clone::Clone;
|
2012-11-28 21:33:00 +01:00
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Export the log levels as global constants. Higher levels mean
|
|
|
|
* more-verbosity. Error is the bottom level, default logging level is
|
|
|
|
* warn-and-below.
|
|
|
|
*/
|
2012-11-28 21:33:00 +01:00
|
|
|
|
|
|
|
/// The error log level
|
|
|
|
pub const error : u32 = 1_u32;
|
|
|
|
/// The warning log level
|
|
|
|
pub const warn : u32 = 2_u32;
|
|
|
|
/// The info log level
|
|
|
|
pub const info : u32 = 3_u32;
|
|
|
|
/// The debug log level
|
|
|
|
pub const debug : u32 = 4_u32;
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/* Unsupported interfaces */
|
|
|
|
|
|
|
|
// Private APIs
|
2013-02-28 04:53:31 +01:00
|
|
|
pub mod unstable;
|
|
|
|
// NOTE: Remove after snapshot
|
|
|
|
#[cfg(stage0)]
|
|
|
|
pub mod private {
|
|
|
|
pub use super::unstable::extfmt;
|
|
|
|
}
|
2012-11-30 09:47:45 +01:00
|
|
|
|
|
|
|
/* For internal use, not exported */
|
|
|
|
|
2013-03-01 19:44:43 +01:00
|
|
|
pub mod unicode;
|
2013-01-19 22:41:25 +01:00
|
|
|
#[path = "num/cmath.rs"]
|
2013-03-01 19:44:43 +01:00
|
|
|
pub mod cmath;
|
|
|
|
pub mod stackwalk;
|
2013-02-04 03:15:43 +01:00
|
|
|
#[path = "rt/mod.rs"]
|
|
|
|
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
|
|
|
|
// 'core' so that macro-expanded references to core::error and such
|
|
|
|
// can be resolved within libcore.
|
|
|
|
#[doc(hidden)] // FIXME #3538
|
2012-12-23 23:41:37 +01:00
|
|
|
pub mod core {
|
2012-11-28 21:33:00 +01:00
|
|
|
pub const error : u32 = 1_u32;
|
|
|
|
pub const warn : u32 = 2_u32;
|
|
|
|
pub const info : u32 = 3_u32;
|
|
|
|
pub const debug : u32 = 4_u32;
|
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
|
|
|
}
|
|
|
|
|
2012-11-30 09:47:45 +01:00
|
|
|
|
2011-12-06 01:46:37 +01:00
|
|
|
// Local Variables:
|
|
|
|
// mode: rust;
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
|
|
|
// End:
|