rust/src/libcore/core.rs
Ben Striegel 43a48ca5bb Automatically export methods on core numeric types
Each numeric type now contains an extensions module that is automatically
exported. At the moment each extensions module contains only the impl for the
`num::num` iface. Other impls soon to follow (hopefully).
2012-06-25 14:25:48 -07:00

75 lines
2.0 KiB
Rust

// Top-level, visible-everywhere definitions.
// Export various ubiquitous types, constructors, methods.
import option::{some, none};
import option = option::option;
import path = path::path;
import str::extensions;
import vec::extensions;
import option::extensions;
import option_iter::extensions;
import ptr::extensions;
import rand::extensions;
import result::extensions;
import int::extensions::*;
import i8::extensions::*;
import i16::extensions::*;
import i32::extensions::*;
import i64::extensions::*;
import uint::extensions::*;
import u8::extensions::*;
import u16::extensions::*;
import u32::extensions::*;
import u64::extensions::*;
import float::extensions::*;
import f32::extensions::*;
import f64::extensions::*;
export path, option, some, none, unreachable;
export extensions;
// The following exports are the extension impls for numeric types
export num;
// Export the log levels as global constants. Higher levels mean
// more-verbosity. Error is the bottom level, default logging level is
// warn-and-below.
export error, warn, info, debug;
#[doc = "The error log level"]
const error : u32 = 0_u32;
#[doc = "The warning log level"]
const warn : u32 = 1_u32;
#[doc = "The info log level"]
const info : u32 = 2_u32;
#[doc = "The debug log level"]
const debug : u32 = 3_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.
mod core {
const error : u32 = 0_u32;
const warn : u32 = 1_u32;
const info : u32 = 2_u32;
const debug : u32 = 3_u32;
}
// Similar to above. Some magic to make core testable.
#[cfg(test)]
mod std {
use std(vers = "0.2");
import std::test;
}
#[doc = "
A standard function to use to indicate unreachable code. Because the
function is guaranteed to fail typestate will correctly identify
any code paths following the appearance of this function as unreachable.
"]
fn unreachable() -> ! {
fail "Internal error: entered unreachable code";
}