Skip to content

Commit e17d998

Browse files
committed
De-export std::{time, prettyprint{,2}, arena}. Part of #3583.
1 parent 1948ddf commit e17d998

File tree

4 files changed

+17
-39
lines changed

4 files changed

+17
-39
lines changed

src/libstd/arena.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,17 @@
2424

2525
#[forbid(deprecated_mode)];
2626

27-
export Arena, arena_with_size;
28-
2927
use list::{List, Cons, Nil};
3028
use cast::reinterpret_cast;
3129
use sys::TypeDesc;
3230
use libc::size_t;
3331

3432
#[abi = "rust-intrinsic"]
3533
extern mod rusti {
36-
#[legacy_exports];
3734
fn move_val_init<T>(&dst: T, -src: T);
3835
fn needs_drop<T>() -> bool;
3936
}
4037
extern mod rustrt {
41-
#[legacy_exports];
4238
#[rust_stack]
4339
fn rust_call_tydesc_glue(root: *u8, tydesc: *TypeDesc, field: size_t);
4440
}
@@ -51,7 +47,7 @@ const tydesc_drop_glue_index: size_t = 3 as size_t;
5147
// will always stay at 0.
5248
type Chunk = {data: @[u8], mut fill: uint, is_pod: bool};
5349

54-
struct Arena {
50+
pub struct Arena {
5551
// The head is seperated out from the list as a unbenchmarked
5652
// microoptimization, to avoid needing to case on the list to
5753
// access the head.
@@ -74,13 +70,13 @@ fn chunk(size: uint, is_pod: bool) -> Chunk {
7470
{ data: unsafe { cast::transmute(v) }, mut fill: 0u, is_pod: is_pod }
7571
}
7672

77-
fn arena_with_size(initial_size: uint) -> Arena {
73+
pub fn arena_with_size(initial_size: uint) -> Arena {
7874
return Arena {mut head: chunk(initial_size, false),
7975
mut pod_head: chunk(initial_size, true),
8076
mut chunks: @Nil};
8177
}
8278

83-
fn Arena() -> Arena {
79+
pub fn Arena() -> Arena {
8480
arena_with_size(32u)
8581
}
8682

src/libstd/prettyprint2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use io::Writer;
44
use io::WriterUtil;
55
use serialization2;
66

7-
struct Serializer {
7+
pub struct Serializer {
88
wr: io::Writer,
99
}
1010

11-
fn Serializer(wr: io::Writer) -> Serializer {
11+
pub fn Serializer(wr: io::Writer) -> Serializer {
1212
Serializer { wr: wr }
1313
}
1414

src/libstd/std.rc

-4
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,9 @@ mod sha1;
111111
mod md4;
112112
mod tempfile;
113113
mod term;
114-
#[legacy_exports]
115114
mod time;
116-
#[legacy_exports]
117115
mod prettyprint;
118-
#[legacy_exports]
119116
mod prettyprint2;
120-
#[legacy_exports]
121117
mod arena;
122118
mod par;
123119
mod cmp;

src/libstd/time.rs

+12-26
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,6 @@ use libc::{c_char, c_int, c_long, size_t, time_t};
55
use io::{Reader, ReaderUtil};
66
use result::{Result, Ok, Err};
77

8-
export
9-
Timespec,
10-
get_time,
11-
precise_time_ns,
12-
precise_time_s,
13-
tzset,
14-
Tm,
15-
empty_tm,
16-
now,
17-
at,
18-
now_utc,
19-
at_utc,
20-
strptime;
21-
228
#[abi = "cdecl"]
239
extern mod rustrt {
2410
#[legacy_exports];
@@ -34,7 +20,7 @@ extern mod rustrt {
3420
}
3521

3622
/// A record specifying a time value in seconds and nanoseconds.
37-
type Timespec = {sec: i64, nsec: i32};
23+
pub type Timespec = {sec: i64, nsec: i32};
3824

3925
impl Timespec : Eq {
4026
pure fn eq(other: &Timespec) -> bool {
@@ -47,7 +33,7 @@ impl Timespec : Eq {
4733
* Returns the current time as a `timespec` containing the seconds and
4834
* nanoseconds since 1970-01-01T00:00:00Z.
4935
*/
50-
fn get_time() -> Timespec {
36+
pub fn get_time() -> Timespec {
5137
let mut sec = 0i64;
5238
let mut nsec = 0i32;
5339
rustrt::get_time(sec, nsec);
@@ -58,7 +44,7 @@ fn get_time() -> Timespec {
5844
* Returns the current value of a high-resolution performance counter
5945
* in nanoseconds since an unspecified epoch.
6046
*/
61-
fn precise_time_ns() -> u64 {
47+
pub fn precise_time_ns() -> u64 {
6248
let mut ns = 0u64;
6349
rustrt::precise_time_ns(ns);
6450
ns
@@ -68,11 +54,11 @@ fn precise_time_ns() -> u64 {
6854
* Returns the current value of a high-resolution performance counter
6955
* in seconds since an unspecified epoch.
7056
*/
71-
fn precise_time_s() -> float {
57+
pub fn precise_time_s() -> float {
7258
return (precise_time_ns() as float) / 1000000000.;
7359
}
7460

75-
fn tzset() {
61+
pub fn tzset() {
7662
rustrt::rust_tzset();
7763
}
7864

@@ -109,7 +95,7 @@ impl Tm_ : Eq {
10995
pure fn ne(other: &Tm_) -> bool { !self.eq(other) }
11096
}
11197

112-
enum Tm {
98+
pub enum Tm {
11399
Tm_(Tm_)
114100
}
115101

@@ -118,7 +104,7 @@ impl Tm : Eq {
118104
pure fn ne(other: &Tm) -> bool { *self != *(*other) }
119105
}
120106

121-
fn empty_tm() -> Tm {
107+
pub fn empty_tm() -> Tm {
122108
Tm_({
123109
tm_sec: 0_i32,
124110
tm_min: 0_i32,
@@ -136,33 +122,33 @@ fn empty_tm() -> Tm {
136122
}
137123

138124
/// Returns the specified time in UTC
139-
fn at_utc(clock: Timespec) -> Tm {
125+
pub fn at_utc(clock: Timespec) -> Tm {
140126
let mut {sec, nsec} = clock;
141127
let mut tm = empty_tm();
142128
rustrt::rust_gmtime(sec, nsec, tm);
143129
tm
144130
}
145131

146132
/// Returns the current time in UTC
147-
fn now_utc() -> Tm {
133+
pub fn now_utc() -> Tm {
148134
at_utc(get_time())
149135
}
150136

151137
/// Returns the specified time in the local timezone
152-
fn at(clock: Timespec) -> Tm {
138+
pub fn at(clock: Timespec) -> Tm {
153139
let mut {sec, nsec} = clock;
154140
let mut tm = empty_tm();
155141
rustrt::rust_localtime(sec, nsec, tm);
156142
tm
157143
}
158144

159145
/// Returns the current time in the local timezone
160-
fn now() -> Tm {
146+
pub fn now() -> Tm {
161147
at(get_time())
162148
}
163149

164150
/// Parses the time from the string according to the format string.
165-
fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
151+
pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
166152
type TmMut = {
167153
mut tm_sec: i32,
168154
mut tm_min: i32,

0 commit comments

Comments
 (0)