2011-12-20 14:29:59 -06:00
|
|
|
// Top-level, visible-everywhere definitions.
|
|
|
|
|
2012-03-02 19:20:00 -06:00
|
|
|
// Export various ubiquitous types, constructors, methods.
|
2011-12-20 14:29:59 -06:00
|
|
|
|
2012-02-21 11:23:01 -06:00
|
|
|
import option::{some, none};
|
2012-03-13 16:39:28 -05:00
|
|
|
import option = option::option;
|
2012-03-02 19:20:00 -06:00
|
|
|
import path = path::path;
|
2012-07-17 18:49:54 -05:00
|
|
|
import tuple::{extensions, tuple_ops, extended_tuple_ops};
|
2012-07-11 17:00:40 -05:00
|
|
|
import str::{extensions, str_slice, unique_str};
|
2012-03-17 20:02:45 -05:00
|
|
|
import vec::extensions;
|
2012-07-11 17:00:40 -05:00
|
|
|
import vec::{const_vector, copyable_vector, immutable_vector};
|
|
|
|
import vec::{immutable_copyable_vector, iter_trait_extensions, vec_concat};
|
2012-07-20 17:33:18 -05:00
|
|
|
import iter::{base_iter, extended_iter, copyable_iter, times, timesi};
|
2012-03-16 19:49:58 -05:00
|
|
|
import option::extensions;
|
2012-04-11 23:45:18 -05:00
|
|
|
import option_iter::extensions;
|
2012-07-11 17:00:40 -05:00
|
|
|
import ptr::{extensions, ptr};
|
2012-05-17 13:52:49 -05:00
|
|
|
import rand::extensions;
|
2012-06-22 19:33:53 -05:00
|
|
|
import result::extensions;
|
2012-07-20 17:33:18 -05:00
|
|
|
import int::{num, times, timesi};
|
|
|
|
import i8::{num, times, timesi};
|
|
|
|
import i16::{num, times, timesi};
|
|
|
|
import i32::{num, times, timesi};
|
|
|
|
import i64::{num, times, timesi};
|
|
|
|
import uint::{num, times, timesi};
|
|
|
|
import u8::{num, times, timesi};
|
|
|
|
import u16::{num, times, timesi};
|
|
|
|
import u32::{num, times, timesi};
|
|
|
|
import u64::{num, times, timesi};
|
2012-06-25 15:41:13 -05:00
|
|
|
import float::num;
|
|
|
|
import f32::num;
|
|
|
|
import f64::num;
|
2012-07-11 17:00:40 -05:00
|
|
|
import num::num;
|
2012-07-25 20:36:18 -05:00
|
|
|
import ops::{const, copy, send, owned};
|
2012-07-27 21:32:42 -05:00
|
|
|
import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor, shl};
|
|
|
|
import ops::{shr, index};
|
2012-03-17 20:02:45 -05:00
|
|
|
|
|
|
|
export path, option, some, none, unreachable;
|
2012-03-16 19:35:38 -05:00
|
|
|
export extensions;
|
2012-06-23 23:05:52 -05:00
|
|
|
// The following exports are the extension impls for numeric types
|
2012-07-20 17:33:18 -05:00
|
|
|
export num, times, timesi;
|
2012-07-11 17:00:40 -05:00
|
|
|
// The following exports are the common traits
|
|
|
|
export str_slice, unique_str;
|
|
|
|
export const_vector, copyable_vector, immutable_vector;
|
|
|
|
export immutable_copyable_vector, iter_trait_extensions, vec_concat;
|
|
|
|
export base_iter, copyable_iter, extended_iter;
|
2012-07-17 18:49:54 -05:00
|
|
|
export tuple_ops, extended_tuple_ops;
|
2012-07-11 17:00:40 -05:00
|
|
|
export ptr;
|
2012-07-25 20:36:18 -05:00
|
|
|
// The following exports are the core operators and kinds
|
|
|
|
export const, copy, send, owned;
|
|
|
|
export add, sub, mul, div, modulo, neg, bitops, index;
|
2011-12-20 14:29:59 -06: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.
|
|
|
|
|
2011-12-22 12:30:04 -06:00
|
|
|
export error, warn, info, debug;
|
2012-01-24 02:54:17 -06:00
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The error log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const error : u32 = 0_u32;
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The warning log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const warn : u32 = 1_u32;
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The info log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const info : u32 = 2_u32;
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The debug log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const debug : u32 = 3_u32;
|
2011-12-22 16:42:52 -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.
|
|
|
|
mod core {
|
|
|
|
const error : u32 = 0_u32;
|
|
|
|
const warn : u32 = 1_u32;
|
|
|
|
const info : u32 = 2_u32;
|
|
|
|
const debug : u32 = 3_u32;
|
2012-01-17 18:45:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Similar to above. Some magic to make core testable.
|
|
|
|
#[cfg(test)]
|
|
|
|
mod std {
|
2012-07-11 11:09:08 -05:00
|
|
|
use std(vers = "0.3");
|
2012-01-17 18:45:22 -06:00
|
|
|
import std::test;
|
2012-01-20 10:12:03 -06:00
|
|
|
}
|
2012-03-08 16:29:17 -06:00
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-03-08 16:29:17 -06:00
|
|
|
fn unreachable() -> ! {
|
2012-07-14 00:57:48 -05:00
|
|
|
fail ~"Internal error: entered unreachable code";
|
2012-03-08 16:29:17 -06:00
|
|
|
}
|
|
|
|
|