rust/src/libcore/core.rc

262 lines
6.4 KiB
Plaintext
Raw Normal View History

2013-02-28 14:15:32 +01:00
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// 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.
/*!
2013-03-25 02:38:17 +01:00
# 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
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`),
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`).
2013-03-25 02:38:17 +01: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
extern mod core;
2013-03-25 02:38:17 +01: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
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:
use core::prelude::*;
*/
#[link(name = "core",
2013-04-05 06:46:37 +02:00
vers = "0.7-pre",
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
#[comment = "The Rust core library"];
#[license = "MIT/ASL2"];
#[crate_type = "lib"];
2012-04-19 10:00:52 +02:00
// Don't link to core. We are core.
#[no_core];
#[warn(vecs_implicitly_copyable)];
#[deny(non_camel_case_types)];
#[allow(deprecated_mutable_fields)];
#[allow(deprecated_drop)];
// Make core testable by not duplicating lang items. See #2912
2013-04-05 06:46:37 +02:00
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
#[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};
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
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};
pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
pub use iter::{ExtendedMutableIter};
pub use num::{Num, NumCast};
pub use ptr::Ptr;
pub use to_str::ToStr;
pub use clone::Clone;
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"]
#[link_args = "-lpthread"]
2013-03-07 04:09:17 +01:00
extern {
}
}
/* The Prelude. */
pub mod prelude;
/* Primitive types */
#[path = "num/int-template.rs"] #[merge = "num/int-template/int.rs"]
pub mod int;
#[path = "num/int-template.rs"] #[merge = "num/int-template/i8.rs"]
2012-11-28 21:33:00 +01:00
pub mod i8;
#[path = "num/int-template.rs"] #[merge = "num/int-template/i16.rs"]
2012-11-28 21:33:00 +01:00
pub mod i16;
#[path = "num/int-template.rs"] #[merge = "num/int-template/i32.rs"]
2012-11-28 21:33:00 +01:00
pub mod i32;
#[path = "num/int-template.rs"] #[merge = "num/int-template/i64.rs"]
2012-11-28 21:33:00 +01:00
pub mod i64;
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/uint.rs"]
2012-11-28 21:33:00 +01:00
pub mod uint;
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u8.rs"]
2012-11-28 21:33:00 +01:00
pub mod u8;
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u16.rs"]
2012-11-28 21:33:00 +01:00
pub mod u16;
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u32.rs"]
2012-11-28 21:33:00 +01:00
pub mod u32;
#[path = "num/uint-template.rs"] #[merge = "num/uint-template/u64.rs"]
2012-11-28 21:33:00 +01:00
pub mod u64;
#[path = "num/float.rs"]
2012-10-04 04:24:06 +02:00
pub mod float;
#[path = "num/f32.rs"]
2012-10-04 04:24:06 +02:00
pub mod f32;
#[path = "num/f64.rs"]
2012-10-04 04:24:06 +02:00
pub mod f64;
2012-12-04 02:28:19 +01:00
pub mod nil;
2012-10-04 04:24:06 +02:00
pub mod bool;
pub mod char;
2012-10-04 04:24:06 +02:00
pub mod tuple;
pub mod vec;
pub mod at_vec;
pub mod str;
pub mod ptr;
pub mod owned;
pub mod managed;
/* Core language traits */
#[cfg(notest)] pub mod kinds;
#[cfg(notest)] pub mod ops;
#[cfg(notest)] pub mod cmp;
/* Common traits */
pub mod from_str;
#[path = "num/num.rs"]
2012-10-04 04:24:06 +02:00
pub mod num;
pub mod 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;
pub mod io;
pub mod hash;
pub mod container;
/* Common data structures */
pub mod option;
pub mod result;
pub mod either;
pub mod hashmap;
pub mod cell;
pub mod trie;
/* 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;
/* Runtime and platform support */
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 flate;
pub mod repr;
pub mod cleanup;
pub mod reflect;
pub mod condition;
pub mod logging;
pub mod util;
/* Unsupported interfaces */
// Private APIs
pub mod unstable;
/* For internal use, not exported */
pub mod unicode;
#[path = "num/cmath.rs"]
pub mod cmath;
pub mod stackwalk;
#[path = "rt/mod.rs"]
pub mod rt;
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)]
mod core {
2013-03-22 20:33:53 +01:00
pub use clone;
2012-12-12 00:16:36 +01:00
pub use cmp;
pub use condition;
pub use option;
pub use kinds;
pub use sys;
2013-02-02 12:10:12 +01:00
pub use pipes;
2012-11-28 21:33:00 +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: