De-export logging, to_str, to_bytes, from_str, util. Part of #3583.
This commit is contained in:
parent
fec96b2ae0
commit
3654287826
|
@ -188,7 +188,6 @@ mod hash;
|
|||
mod either;
|
||||
#[legacy_exports]
|
||||
mod iter;
|
||||
#[legacy_exports]
|
||||
mod logging;
|
||||
#[legacy_exports]
|
||||
mod option;
|
||||
|
@ -201,13 +200,9 @@ mod option_iter {
|
|||
}
|
||||
#[legacy_exports]
|
||||
mod result;
|
||||
#[legacy_exports]
|
||||
mod to_str;
|
||||
#[legacy_exports]
|
||||
mod to_bytes;
|
||||
#[legacy_exports]
|
||||
mod from_str;
|
||||
#[legacy_exports]
|
||||
mod util;
|
||||
|
||||
// Data structure modules
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use option::Option;
|
||||
|
||||
trait FromStr {
|
||||
pub trait FromStr {
|
||||
static fn from_str(s: &str) -> Option<self>;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ use cast::transmute;
|
|||
|
||||
#[nolink]
|
||||
extern mod rustrt {
|
||||
#[legacy_exports];
|
||||
fn rust_log_console_on();
|
||||
fn rust_log_console_off();
|
||||
fn rust_log_str(level: u32, string: *libc::c_char, size: libc::size_t);
|
||||
|
|
|
@ -10,7 +10,7 @@ The `ToBytes` and `IterBytes` traits
|
|||
|
||||
use io::Writer;
|
||||
|
||||
type Cb = fn(buf: &[const u8]) -> bool;
|
||||
pub type Cb = fn(buf: &[const u8]) -> bool;
|
||||
|
||||
/**
|
||||
* A trait to implement in order to make a type hashable;
|
||||
|
@ -19,7 +19,7 @@ type Cb = fn(buf: &[const u8]) -> bool;
|
|||
* modified when default methods and trait inheritence are
|
||||
* completed.
|
||||
*/
|
||||
trait IterBytes {
|
||||
pub trait IterBytes {
|
||||
/**
|
||||
* Call the provided callback `f` one or more times with
|
||||
* byte-slices that should be used when computing a hash
|
||||
|
@ -211,7 +211,7 @@ impl<A: IterBytes> @[A]: IterBytes {
|
|||
}
|
||||
}
|
||||
|
||||
pure fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B,
|
||||
pub pure fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B,
|
||||
lsb0: bool, z: Cb) {
|
||||
let mut flag = true;
|
||||
a.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
|
||||
|
@ -219,7 +219,7 @@ pure fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B,
|
|||
b.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
|
||||
}
|
||||
|
||||
pure fn iter_bytes_3<A: IterBytes,
|
||||
pub pure fn iter_bytes_3<A: IterBytes,
|
||||
B: IterBytes,
|
||||
C: IterBytes>(a: &A, b: &B, c: &C,
|
||||
lsb0: bool, z: Cb) {
|
||||
|
@ -231,7 +231,7 @@ pure fn iter_bytes_3<A: IterBytes,
|
|||
c.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
|
||||
}
|
||||
|
||||
pure fn iter_bytes_4<A: IterBytes,
|
||||
pub pure fn iter_bytes_4<A: IterBytes,
|
||||
B: IterBytes,
|
||||
C: IterBytes,
|
||||
D: IterBytes>(a: &A, b: &B, c: &C,
|
||||
|
@ -247,7 +247,7 @@ pure fn iter_bytes_4<A: IterBytes,
|
|||
d.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
|
||||
}
|
||||
|
||||
pure fn iter_bytes_5<A: IterBytes,
|
||||
pub pure fn iter_bytes_5<A: IterBytes,
|
||||
B: IterBytes,
|
||||
C: IterBytes,
|
||||
D: IterBytes,
|
||||
|
@ -266,7 +266,7 @@ pure fn iter_bytes_5<A: IterBytes,
|
|||
e.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
|
||||
}
|
||||
|
||||
pure fn iter_bytes_6<A: IterBytes,
|
||||
pub pure fn iter_bytes_6<A: IterBytes,
|
||||
B: IterBytes,
|
||||
C: IterBytes,
|
||||
D: IterBytes,
|
||||
|
@ -288,7 +288,7 @@ pure fn iter_bytes_6<A: IterBytes,
|
|||
f.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag});
|
||||
}
|
||||
|
||||
pure fn iter_bytes_7<A: IterBytes,
|
||||
pub pure fn iter_bytes_7<A: IterBytes,
|
||||
B: IterBytes,
|
||||
C: IterBytes,
|
||||
D: IterBytes,
|
||||
|
|
|
@ -8,7 +8,7 @@ The `ToStr` trait for converting to strings
|
|||
#[forbid(deprecated_mode)];
|
||||
#[forbid(deprecated_pattern)];
|
||||
|
||||
trait ToStr { fn to_str() -> ~str; }
|
||||
pub trait ToStr { fn to_str() -> ~str; }
|
||||
|
||||
impl int: ToStr {
|
||||
fn to_str() -> ~str { int::str(self) }
|
||||
|
@ -101,7 +101,6 @@ impl<A: ToStr> ~A: ToStr {
|
|||
#[cfg(test)]
|
||||
#[allow(non_implicitly_copyable_typarams)]
|
||||
mod tests {
|
||||
#[legacy_exports];
|
||||
#[test]
|
||||
fn test_simple_types() {
|
||||
assert 1.to_str() == ~"1";
|
||||
|
|
|
@ -12,16 +12,16 @@ use cmp::Eq;
|
|||
|
||||
/// The identity function.
|
||||
#[inline(always)]
|
||||
pure fn id<T>(+x: T) -> T { move x }
|
||||
pub pure fn id<T>(+x: T) -> T { move x }
|
||||
|
||||
/// Ignores a value.
|
||||
#[inline(always)]
|
||||
pure fn ignore<T>(+_x: T) { }
|
||||
pub pure fn ignore<T>(+_x: T) { }
|
||||
|
||||
/// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the
|
||||
/// original value of `*ptr`.
|
||||
#[inline(always)]
|
||||
fn with<T: Copy, R>(
|
||||
pub fn with<T: Copy, R>(
|
||||
ptr: &mut T,
|
||||
+new_value: T,
|
||||
op: &fn() -> R) -> R
|
||||
|
@ -41,7 +41,7 @@ fn with<T: Copy, R>(
|
|||
* deinitialising or copying either one.
|
||||
*/
|
||||
#[inline(always)]
|
||||
fn swap<T>(x: &mut T, y: &mut T) {
|
||||
pub fn swap<T>(x: &mut T, y: &mut T) {
|
||||
*x <-> *y;
|
||||
}
|
||||
|
||||
|
@ -50,19 +50,19 @@ fn swap<T>(x: &mut T, y: &mut T) {
|
|||
* value, without deinitialising or copying either one.
|
||||
*/
|
||||
#[inline(always)]
|
||||
fn replace<T>(dest: &mut T, +src: T) -> T {
|
||||
pub fn replace<T>(dest: &mut T, +src: T) -> T {
|
||||
let mut tmp <- src;
|
||||
swap(dest, &mut tmp);
|
||||
move tmp
|
||||
}
|
||||
|
||||
/// A non-copyable dummy type.
|
||||
struct NonCopyable {
|
||||
pub struct NonCopyable {
|
||||
i: (),
|
||||
drop { }
|
||||
}
|
||||
|
||||
fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }
|
||||
pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }
|
||||
|
||||
/**
|
||||
A utility function for indicating unreachable code. It will fail if
|
||||
|
@ -88,7 +88,7 @@ fn choose_weighted_item(v: &[Item]) -> Item {
|
|||
~~~
|
||||
|
||||
*/
|
||||
fn unreachable() -> ! {
|
||||
pub fn unreachable() -> ! {
|
||||
fail ~"internal error: entered unreachable code";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue