Skip to content

Commit 70ae3e7

Browse files
committed
De-export std::{bitv, cell, timer}. Part of #3583.
1 parent 94f7bf9 commit 70ae3e7

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

src/libstd/bitv.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
use vec::{to_mut, from_elem};
44

5-
export Bitv, from_bytes, from_bools, from_fn;
6-
75
struct SmallBitv {
86
/// only the lowest nbits of this value are used. the rest is undefined.
97
mut bits: u32
@@ -209,12 +207,12 @@ enum BitvVariant { Big(~BigBitv), Small(~SmallBitv) }
209207
enum Op {Union, Intersect, Assign, Difference}
210208

211209
// The bitvector type
212-
struct Bitv {
210+
pub struct Bitv {
213211
rep: BitvVariant,
214212
nbits: uint
215213
}
216214

217-
fn Bitv (nbits: uint, init: bool) -> Bitv {
215+
pub fn Bitv (nbits: uint, init: bool) -> Bitv {
218216
let rep = if nbits <= 32 {
219217
Small(~SmallBitv(if init {!0} else {0}))
220218
}
@@ -519,7 +517,7 @@ impl Bitv {
519517
* with the most significant bits of each byte coming first. Each
520518
* bit becomes true if equal to 1 or false if equal to 0.
521519
*/
522-
fn from_bytes(bytes: &[u8]) -> Bitv {
520+
pub fn from_bytes(bytes: &[u8]) -> Bitv {
523521
from_fn(bytes.len() * 8, |i| {
524522
let b = bytes[i / 8] as uint;
525523
let offset = i % 8;
@@ -530,15 +528,15 @@ fn from_bytes(bytes: &[u8]) -> Bitv {
530528
/**
531529
* Transform a [bool] into a bitv by converting each bool into a bit.
532530
*/
533-
fn from_bools(bools: &[bool]) -> Bitv {
531+
pub fn from_bools(bools: &[bool]) -> Bitv {
534532
from_fn(bools.len(), |i| bools[i])
535533
}
536534

537535
/**
538536
* Create a bitv of the specified length where the value at each
539537
* index is f(index).
540538
*/
541-
fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv {
539+
pub fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv {
542540
let bitv = Bitv(len, false);
543541
for uint::range(0, len) |i| {
544542
bitv.set(i, f(i));

src/libstd/cell.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
///
44
/// Similar to a mutable option type, but friendlier.
55
6-
struct Cell<T> {
6+
pub struct Cell<T> {
77
mut value: Option<T>
88
}
99

1010
/// Creates a new full cell with the given value.
11-
fn Cell<T>(+value: T) -> Cell<T> {
11+
pub fn Cell<T>(+value: T) -> Cell<T> {
1212
Cell { value: Some(move value) }
1313
}
1414

15-
fn empty_cell<T>() -> Cell<T> {
15+
pub fn empty_cell<T>() -> Cell<T> {
1616
Cell { value: None }
1717
}
1818

src/libstd/std.rc

-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ mod uv_global_loop;
6969

7070
#[legacy_exports]
7171
mod c_vec;
72-
#[legacy_exports]
7372
mod timer;
74-
#[legacy_exports]
7573
mod cell;
7674

7775
// Concurrency
@@ -85,7 +83,6 @@ mod comm;
8583

8684
// Collections
8785

88-
#[legacy_exports]
8986
mod bitv;
9087
#[legacy_exports]
9188
mod deque;

src/libstd/timer.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ use uv::iotask;
77
use iotask::IoTask;
88
use comm = core::comm;
99

10-
export delayed_send, sleep, recv_timeout;
11-
1210
/**
1311
* Wait for timeout period then send provided value over a channel
1412
*
@@ -25,8 +23,8 @@ export delayed_send, sleep, recv_timeout;
2523
* * ch - a channel of type T to send a `val` on
2624
* * val - a value of type T to send over the provided `ch`
2725
*/
28-
fn delayed_send<T: Copy Send>(iotask: IoTask,
29-
msecs: uint, ch: comm::Chan<T>, +val: T) {
26+
pub fn delayed_send<T: Copy Send>(iotask: IoTask,
27+
msecs: uint, ch: comm::Chan<T>, +val: T) {
3028
unsafe {
3129
let timer_done_po = core::comm::Port::<()>();
3230
let timer_done_ch = core::comm::Chan(timer_done_po);
@@ -74,7 +72,7 @@ fn delayed_send<T: Copy Send>(iotask: IoTask,
7472
* * `iotask` - a `uv::iotask` that the tcp request will run on
7573
* * msecs - an amount of time, in milliseconds, for the current task to block
7674
*/
77-
fn sleep(iotask: IoTask, msecs: uint) {
75+
pub fn sleep(iotask: IoTask, msecs: uint) {
7876
let exit_po = core::comm::Port::<()>();
7977
let exit_ch = core::comm::Chan(exit_po);
8078
delayed_send(iotask, msecs, exit_ch, ());
@@ -101,7 +99,7 @@ fn sleep(iotask: IoTask, msecs: uint) {
10199
* on the provided port in the allotted timeout period, then the result will
102100
* be a `some(T)`. If not, then `none` will be returned.
103101
*/
104-
fn recv_timeout<T: Copy Send>(iotask: IoTask,
102+
pub fn recv_timeout<T: Copy Send>(iotask: IoTask,
105103
msecs: uint,
106104
wait_po: comm::Port<T>) -> Option<T> {
107105
let timeout_po = comm::Port::<()>();

0 commit comments

Comments
 (0)