diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-09-28 14:55:31 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-09-28 14:55:43 -0700 |
| commit | 70ae3e7bf212b0db5949e113858bae1da0e6ae29 (patch) | |
| tree | 6ad1ae76eb930a44e835a590d3762a1ebfb86220 /src/libstd | |
| parent | 94f7bf98f96a14fa14c45723a9e40f348ab9d655 (diff) | |
| download | rust-70ae3e7bf212b0db5949e113858bae1da0e6ae29.tar.gz rust-70ae3e7bf212b0db5949e113858bae1da0e6ae29.zip | |
De-export std::{bitv, cell, timer}. Part of #3583.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bitv.rs | 12 | ||||
| -rw-r--r-- | src/libstd/cell.rs | 6 | ||||
| -rw-r--r-- | src/libstd/std.rc | 3 | ||||
| -rw-r--r-- | src/libstd/timer.rs | 10 |
4 files changed, 12 insertions, 19 deletions
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 33065fffd03..370c5ddb566 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -2,8 +2,6 @@ use vec::{to_mut, from_elem}; -export Bitv, from_bytes, from_bools, from_fn; - struct SmallBitv { /// only the lowest nbits of this value are used. the rest is undefined. mut bits: u32 @@ -209,12 +207,12 @@ enum BitvVariant { Big(~BigBitv), Small(~SmallBitv) } enum Op {Union, Intersect, Assign, Difference} // The bitvector type -struct Bitv { +pub struct Bitv { rep: BitvVariant, nbits: uint } -fn Bitv (nbits: uint, init: bool) -> Bitv { +pub fn Bitv (nbits: uint, init: bool) -> Bitv { let rep = if nbits <= 32 { Small(~SmallBitv(if init {!0} else {0})) } @@ -519,7 +517,7 @@ impl Bitv { * with the most significant bits of each byte coming first. Each * bit becomes true if equal to 1 or false if equal to 0. */ -fn from_bytes(bytes: &[u8]) -> Bitv { +pub fn from_bytes(bytes: &[u8]) -> Bitv { from_fn(bytes.len() * 8, |i| { let b = bytes[i / 8] as uint; let offset = i % 8; @@ -530,7 +528,7 @@ fn from_bytes(bytes: &[u8]) -> Bitv { /** * Transform a [bool] into a bitv by converting each bool into a bit. */ -fn from_bools(bools: &[bool]) -> Bitv { +pub fn from_bools(bools: &[bool]) -> Bitv { from_fn(bools.len(), |i| bools[i]) } @@ -538,7 +536,7 @@ fn from_bools(bools: &[bool]) -> Bitv { * Create a bitv of the specified length where the value at each * index is f(index). */ -fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv { +pub fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv { let bitv = Bitv(len, false); for uint::range(0, len) |i| { bitv.set(i, f(i)); diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index 4ef695f4198..43e47e1e1a9 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -3,16 +3,16 @@ /// /// Similar to a mutable option type, but friendlier. -struct Cell<T> { +pub struct Cell<T> { mut value: Option<T> } /// Creates a new full cell with the given value. -fn Cell<T>(+value: T) -> Cell<T> { +pub fn Cell<T>(+value: T) -> Cell<T> { Cell { value: Some(move value) } } -fn empty_cell<T>() -> Cell<T> { +pub fn empty_cell<T>() -> Cell<T> { Cell { value: None } } diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 5370f20cfa1..13f7b967723 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -69,9 +69,7 @@ mod uv_global_loop; #[legacy_exports] mod c_vec; -#[legacy_exports] mod timer; -#[legacy_exports] mod cell; // Concurrency @@ -85,7 +83,6 @@ mod comm; // Collections -#[legacy_exports] mod bitv; #[legacy_exports] mod deque; diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index ae79892b873..a2f9796f89e 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -7,8 +7,6 @@ use uv::iotask; use iotask::IoTask; use comm = core::comm; -export delayed_send, sleep, recv_timeout; - /** * Wait for timeout period then send provided value over a channel * @@ -25,8 +23,8 @@ export delayed_send, sleep, recv_timeout; * * ch - a channel of type T to send a `val` on * * val - a value of type T to send over the provided `ch` */ -fn delayed_send<T: Copy Send>(iotask: IoTask, - msecs: uint, ch: comm::Chan<T>, +val: T) { +pub fn delayed_send<T: Copy Send>(iotask: IoTask, + msecs: uint, ch: comm::Chan<T>, +val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); let timer_done_ch = core::comm::Chan(timer_done_po); @@ -74,7 +72,7 @@ fn delayed_send<T: Copy Send>(iotask: IoTask, * * `iotask` - a `uv::iotask` that the tcp request will run on * * msecs - an amount of time, in milliseconds, for the current task to block */ -fn sleep(iotask: IoTask, msecs: uint) { +pub fn sleep(iotask: IoTask, msecs: uint) { let exit_po = core::comm::Port::<()>(); let exit_ch = core::comm::Chan(exit_po); delayed_send(iotask, msecs, exit_ch, ()); @@ -101,7 +99,7 @@ fn sleep(iotask: IoTask, msecs: uint) { * on the provided port in the allotted timeout period, then the result will * be a `some(T)`. If not, then `none` will be returned. */ -fn recv_timeout<T: Copy Send>(iotask: IoTask, +pub fn recv_timeout<T: Copy Send>(iotask: IoTask, msecs: uint, wait_po: comm::Port<T>) -> Option<T> { let timeout_po = comm::Port::<()>(); |
