diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-09-28 17:41:45 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-09-28 17:47:09 -0700 |
| commit | 365428782660b01a8702b589214ca20d35efd23d (patch) | |
| tree | 67b445faf8a6435f1245103067c70b26665f6095 /src/libcore/util.rs | |
| parent | fec96b2ae0f387488f718390eee4c67a043d9a9b (diff) | |
| download | rust-365428782660b01a8702b589214ca20d35efd23d.tar.gz rust-365428782660b01a8702b589214ca20d35efd23d.zip | |
De-export logging, to_str, to_bytes, from_str, util. Part of #3583.
Diffstat (limited to 'src/libcore/util.rs')
| -rw-r--r-- | src/libcore/util.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 8c38949f5df..9ba8b52f5da 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -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"; } |
