rust/src/libcore/core.rc

279 lines
6.6 KiB
Plaintext
Raw Normal View History

/*!
The Rust core library.
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,
vectors (`vec`), shared boxes (`box`), and unsafe and borrowed pointers
2012-09-20 02:17:00 +02:00
(`ptr`). Additionally, `core` provides task management and creation (`task`),
communication primitives (`comm` and `pipes`), an efficient vector builder
(`dvec`), 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 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:
extern mod core;
use core::*;
*/
#[link(name = "core",
2012-10-13 01:41:25 +02:00
vers = "0.5",
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
#[comment = "The Rust core library"];
#[license = "MIT"];
#[crate_type = "lib"];
2012-04-19 10:00:52 +02:00
// Don't link to core. We are core.
#[no_core];
#[warn(deprecated_mode)];
2012-09-28 23:49:49 +02:00
#[warn(deprecated_pattern)];
#[warn(vecs_implicitly_copyable)];
#[deny(non_camel_case_types)];
// Built-in-type support modules
/// Operations and constants for `int`
2012-11-28 21:33:00 +01:00
#[path = "int-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "int-template/int.rs"]
2012-11-28 21:33:00 +01:00
pub mod int;
/// Operations and constants for `i8`
2012-11-28 21:33:00 +01:00
#[path = "int-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "int-template/i8.rs"]
2012-11-28 21:33:00 +01:00
pub mod i8;
/// Operations and constants for `i16`
2012-11-28 21:33:00 +01:00
#[path = "int-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "int-template/i16.rs"]
2012-11-28 21:33:00 +01:00
pub mod i16;
/// Operations and constants for `i32`
2012-11-28 21:33:00 +01:00
#[path = "int-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "int-template/i32.rs"]
2012-11-28 21:33:00 +01:00
pub mod i32;
/// Operations and constants for `i64`
2012-11-28 21:33:00 +01:00
#[path = "int-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "int-template/i64.rs"]
2012-11-28 21:33:00 +01:00
pub mod i64;
/// Operations and constants for `uint`
2012-11-28 21:33:00 +01:00
#[path = "uint-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "uint-template/uint.rs"]
2012-11-28 21:33:00 +01:00
pub mod uint;
/// Operations and constants for `u8`
2012-11-28 21:33:00 +01:00
#[path = "uint-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "uint-template/u8.rs"]
2012-11-28 21:33:00 +01:00
pub mod u8;
/// Operations and constants for `u16`
2012-11-28 21:33:00 +01:00
#[path = "uint-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "uint-template/u16.rs"]
2012-11-28 21:33:00 +01:00
pub mod u16;
/// Operations and constants for `u32`
2012-11-28 21:33:00 +01:00
#[path = "uint-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "uint-template/u32.rs"]
2012-11-28 21:33:00 +01:00
pub mod u32;
/// Operations and constants for `u64`
2012-11-28 21:33:00 +01:00
#[path = "uint-template.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "uint-template/u64.rs"]
2012-11-28 21:33:00 +01:00
pub mod u64;
2012-04-19 10:00:52 +02:00
2012-10-04 04:24:06 +02:00
pub mod box;
pub mod char;
pub mod float;
pub mod f32;
pub mod f64;
pub mod str;
pub mod ptr;
pub mod vec;
pub mod at_vec;
pub mod bool;
pub mod tuple;
pub mod unit;
pub mod owned;
// Ubiquitous-utility-type modules
#[cfg(notest)]
2012-10-04 04:24:06 +02:00
pub mod ops;
pub mod cmp;
pub mod num;
pub mod hash;
pub mod either;
pub mod iter;
pub mod logging;
pub mod option;
2012-11-28 21:33:00 +01:00
#[path="iter-trait.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "iter-trait/option.rs"]
2012-11-28 21:33:00 +01:00
pub mod option_iter;
2012-10-04 04:24:06 +02:00
pub mod result;
pub mod to_str;
pub mod to_bytes;
pub mod from_str;
pub mod util;
2012-11-27 01:12:47 +01:00
pub mod clone;
// Data structure modules
2012-10-04 04:24:06 +02:00
pub mod dvec;
2012-11-28 21:33:00 +01:00
#[path="iter-trait.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "iter-trait/dvec.rs"]
2012-11-28 21:33:00 +01:00
pub mod dvec_iter;
2012-10-04 04:24:06 +02:00
pub mod dlist;
2012-11-28 21:33:00 +01:00
#[path="iter-trait.rs"]
2012-11-29 00:24:39 +01:00
#[merge = "iter-trait/dlist.rs"]
2012-11-28 21:33:00 +01:00
pub mod dlist_iter;
2012-10-04 04:24:06 +02:00
pub mod send_map;
2012-04-19 10:00:52 +02:00
// Concurrency
2012-10-04 04:24:06 +02:00
pub mod comm;
2012-11-28 21:33:00 +01:00
#[merge = "task/mod.rs"]
pub mod task;
2012-10-04 04:24:06 +02:00
pub mod pipes;
// Runtime and language-primitive support
2012-10-04 04:24:06 +02:00
pub mod gc;
pub mod io;
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;
pub mod condition;
2012-04-19 10:00:52 +02:00
// Modules supporting compiler-generated code
// Exported but not part of the public interface
2012-10-04 04:24:06 +02:00
pub mod extfmt;
2012-07-11 00:52:05 +02:00
// The test harness links against core, so don't include runtime in tests.
#[cfg(notest)]
#[legacy_exports]
2012-10-04 04:24:06 +02:00
pub mod rt;
// Ideally not exported, but currently is.
2012-10-04 04:24:06 +02:00
pub mod private;
// For internal use, not exported.
2012-04-19 10:00:52 +02:00
mod unicode;
mod cmath;
2012-06-06 03:47:18 +02:00
mod stackwalk;
2012-04-19 10:00:52 +02:00
2012-11-28 21:33:00 +01:00
// Top-level, visible-everywhere definitions.
// Export various ubiquitous types, constructors, methods.
pub use option::{Some, None};
pub use Option = option::Option;
pub use result::{Result, Ok, Err};
pub use Path = path::Path;
pub use GenericPath = path::GenericPath;
pub use WindowsPath = path::WindowsPath;
pub use PosixPath = path::PosixPath;
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
pub use str::{StrSlice, Trimmable};
pub use vec::{ConstVector, CopyableVector, ImmutableVector};
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
pub use vec::{MutableVector, MutableCopyableVector};
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
pub use num::Num;
pub use ptr::Ptr;
pub use to_str::ToStr;
// The following exports are the core operators and kinds
// The compiler has special knowlege of these so we must not duplicate them
// when compiling for testing
#[cfg(notest)]
pub use ops::{Const, Copy, Send, Owned};
#[cfg(notest)]
pub use ops::{Drop};
#[cfg(notest)]
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor};
#[cfg(notest)]
pub use ops::{Shl, Shr, Index};
#[cfg(test)]
extern mod coreops(name = "core", vers = "0.5");
#[cfg(test)]
pub use coreops::ops::{Const, Copy, Send, Owned};
#[cfg(test)]
pub use coreops::ops::{Drop};
#[cfg(test)]
pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr};
#[cfg(test)]
pub use coreops::ops::{BitXor};
#[cfg(test)]
pub use coreops::ops::{Shl, Shr, Index};
#[cfg(notest)]
pub use clone::Clone;
#[cfg(test)]
pub use coreops::clone::Clone;
2012-11-28 21:33:00 +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.
/// 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;
// 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
mod core {
pub const error : u32 = 1_u32;
pub const warn : u32 = 2_u32;
pub const info : u32 = 3_u32;
pub const debug : u32 = 4_u32;
}
// Similar to above. Some magic to make core testable.
#[cfg(test)]
mod std {
extern mod std(vers = "0.5");
pub use std::test;
}
// Local Variables:
// mode: rust;
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// End: