Skip to content

Commit 94720fc

Browse files
committed
std: More camel casing
1 parent d8b34b2 commit 94720fc

File tree

7 files changed

+59
-50
lines changed

7 files changed

+59
-50
lines changed

src/libstd/net_ip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
import vec;
44
import uint;
5-
import iotask = uv::iotask::iotask;
5+
import iotask = uv::iotask::IoTask;
66
import interact = uv::iotask::interact;
77

88
import sockaddr_in = uv::ll::sockaddr_in;

src/libstd/net_tcp.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
import ip = net_ip;
44
import uv::iotask;
5-
import uv::iotask::iotask;
5+
import uv::iotask::IoTask;
66
import future_spawn = future::spawn;
77
// FIXME #1935
88
// should be able to, but can't atm, replace w/ result::{result, extensions};
@@ -119,7 +119,7 @@ enum tcp_connect_err_data {
119119
* `net::tcp::tcp_connect_err_data` instance will be returned
120120
*/
121121
fn connect(-input_ip: ip::ip_addr, port: uint,
122-
iotask: iotask)
122+
iotask: IoTask)
123123
-> result::Result<tcp_socket, tcp_connect_err_data> unsafe {
124124
let result_po = core::comm::Port::<conn_attempt>();
125125
let closed_signal_po = core::comm::Port::<()>();
@@ -560,7 +560,7 @@ fn accept(new_conn: tcp_new_connection)
560560
* of listen exiting because of an error
561561
*/
562562
fn listen(-host_ip: ip::ip_addr, port: uint, backlog: uint,
563-
iotask: iotask,
563+
iotask: IoTask,
564564
on_establish_cb: fn~(comm::Chan<Option<tcp_err_data>>),
565565
+new_connect_cb: fn~(tcp_new_connection,
566566
comm::Chan<Option<tcp_err_data>>))
@@ -577,7 +577,7 @@ fn listen(-host_ip: ip::ip_addr, port: uint, backlog: uint,
577577
}
578578

579579
fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
580-
iotask: iotask,
580+
iotask: IoTask,
581581
on_establish_cb: fn~(comm::Chan<Option<tcp_err_data>>),
582582
-on_connect_cb: fn~(*uv::ll::uv_tcp_t))
583583
-> result::Result<(), tcp_listen_err_data> unsafe {
@@ -1003,7 +1003,7 @@ type tcp_listen_fc_data = {
10031003
stream_closed_ch: comm::Chan<()>,
10041004
kill_ch: comm::Chan<Option<tcp_err_data>>,
10051005
on_connect_cb: fn~(*uv::ll::uv_tcp_t),
1006-
iotask: iotask,
1006+
iotask: IoTask,
10071007
mut active: bool
10081008
};
10091009

@@ -1202,7 +1202,7 @@ type tcp_socket_data = {
12021202
stream_handle_ptr: *uv::ll::uv_tcp_t,
12031203
connect_req: uv::ll::uv_connect_t,
12041204
write_req: uv::ll::uv_write_t,
1205-
iotask: iotask
1205+
iotask: IoTask
12061206
};
12071207

12081208
type tcp_buffered_socket_data = {
@@ -1479,7 +1479,7 @@ mod test {
14791479
fn run_tcp_test_server(server_ip: ~str, server_port: uint, resp: ~str,
14801480
server_ch: comm::Chan<~str>,
14811481
cont_ch: comm::Chan<()>,
1482-
iotask: iotask) -> ~str {
1482+
iotask: IoTask) -> ~str {
14831483
let server_ip_addr = ip::v4::parse_addr(server_ip);
14841484
let listen_result = listen(server_ip_addr, server_port, 128u, iotask,
14851485
// on_establish_cb -- called when listener is set up
@@ -1562,7 +1562,7 @@ mod test {
15621562
}
15631563

15641564
fn run_tcp_test_server_fail(server_ip: ~str, server_port: uint,
1565-
iotask: iotask) -> tcp_listen_err_data {
1565+
iotask: IoTask) -> tcp_listen_err_data {
15661566
let server_ip_addr = ip::v4::parse_addr(server_ip);
15671567
let listen_result = listen(server_ip_addr, server_port, 128u, iotask,
15681568
// on_establish_cb -- called when listener is set up
@@ -1585,7 +1585,7 @@ mod test {
15851585

15861586
fn run_tcp_test_client(server_ip: ~str, server_port: uint, resp: ~str,
15871587
client_ch: comm::Chan<~str>,
1588-
iotask: iotask) -> result::Result<~str,
1588+
iotask: IoTask) -> result::Result<~str,
15891589
tcp_connect_err_data> {
15901590
let server_ip_addr = ip::v4::parse_addr(server_ip);
15911591

src/libstd/std.rc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,22 @@ mod net_tcp;
3636
mod net_url;
3737

3838
// libuv modules
39+
#[warn(non_camel_case_types)]
3940
mod uv;
4041
mod uv_ll;
42+
#[warn(non_camel_case_types)]
4143
mod uv_iotask;
44+
#[warn(non_camel_case_types)]
4245
mod uv_global_loop;
4346

4447

4548
// Utility modules
4649

50+
#[warn(non_camel_case_types)]
4751
mod c_vec;
52+
#[warn(non_camel_case_types)]
4853
mod timer;
54+
#[warn(non_camel_case_types)]
4955
mod cell;
5056

5157
// Concurrency
@@ -54,6 +60,7 @@ mod cell;
5460
mod sync;
5561
#[warn(non_camel_case_types)]
5662
mod arc;
63+
#[warn(non_camel_case_types)]
5764
mod comm;
5865

5966
// Collections

src/libstd/timer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import uv = uv;
77
import uv::iotask;
8-
import iotask::iotask;
8+
import iotask::IoTask;
99
import comm = core::comm;
1010

1111
export delayed_send, sleep, recv_timeout;
@@ -26,7 +26,7 @@ export delayed_send, sleep, recv_timeout;
2626
* * ch - a channel of type T to send a `val` on
2727
* * val - a value of type T to send over the provided `ch`
2828
*/
29-
fn delayed_send<T: copy send>(iotask: iotask,
29+
fn delayed_send<T: copy send>(iotask: IoTask,
3030
msecs: uint, ch: comm::Chan<T>, +val: T) {
3131
unsafe {
3232
let timer_done_po = core::comm::Port::<()>();
@@ -75,7 +75,7 @@ fn delayed_send<T: copy send>(iotask: iotask,
7575
* * `iotask` - a `uv::iotask` that the tcp request will run on
7676
* * msecs - an amount of time, in milliseconds, for the current task to block
7777
*/
78-
fn sleep(iotask: iotask, msecs: uint) {
78+
fn sleep(iotask: IoTask, msecs: uint) {
7979
let exit_po = core::comm::Port::<()>();
8080
let exit_ch = core::comm::Chan(exit_po);
8181
delayed_send(iotask, msecs, exit_ch, ());
@@ -102,7 +102,7 @@ fn sleep(iotask: iotask, msecs: uint) {
102102
* on the provided port in the allotted timeout period, then the result will
103103
* be a `some(T)`. If not, then `none` will be returned.
104104
*/
105-
fn recv_timeout<T: copy send>(iotask: iotask,
105+
fn recv_timeout<T: copy send>(iotask: IoTask,
106106
msecs: uint,
107107
wait_po: comm::Port<T>) -> Option<T> {
108108
let timeout_po = comm::Port::<()>();

src/libstd/uv_global_loop.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export get;
55
import ll = uv_ll;
66
import iotask = uv_iotask;
77
import get_gl = get;
8-
import iotask::{iotask, spawn_iotask};
8+
import iotask::{IoTask, spawn_iotask};
99
import priv::{chan_from_global_ptr, weaken_task};
1010
import comm = core::comm;
1111
import comm::{Port, Chan, select2, listen};
@@ -28,23 +28,23 @@ extern mod rustrt {
2828
* * A `hl::high_level_loop` that encapsulates communication with the global
2929
* loop.
3030
*/
31-
fn get() -> iotask {
31+
fn get() -> IoTask {
3232
return get_monitor_task_gl();
3333
}
3434

3535
#[doc(hidden)]
36-
fn get_monitor_task_gl() -> iotask unsafe {
36+
fn get_monitor_task_gl() -> IoTask unsafe {
3737

3838
let monitor_loop_chan_ptr = rustrt::rust_uv_get_kernel_global_chan_ptr();
3939

4040
debug!("ENTERING global_loop::get() loop chan: %?",
4141
monitor_loop_chan_ptr);
4242

4343
debug!("before priv::chan_from_global_ptr");
44-
type monchan = Chan<iotask>;
44+
type MonChan = Chan<IoTask>;
4545

4646
let monitor_ch =
47-
do chan_from_global_ptr::<monchan>(monitor_loop_chan_ptr,
47+
do chan_from_global_ptr::<MonChan>(monitor_loop_chan_ptr,
4848
|| {
4949
task::task().sched_mode
5050
(task::SingleThreaded)
@@ -85,7 +85,7 @@ fn get_monitor_task_gl() -> iotask unsafe {
8585
}
8686
}
8787

88-
fn spawn_loop() -> iotask {
88+
fn spawn_loop() -> IoTask {
8989
let builder = do task::task().add_wrapper |task_body| {
9090
fn~(move task_body) {
9191
// The I/O loop task also needs to be weak so it doesn't keep
@@ -131,7 +131,7 @@ mod test {
131131
log(debug, ~"exiting simple timer cb");
132132
}
133133

134-
fn impl_uv_hl_simple_timer(iotask: iotask) unsafe {
134+
fn impl_uv_hl_simple_timer(iotask: IoTask) unsafe {
135135
let exit_po = core::comm::Port::<bool>();
136136
let exit_ch = core::comm::Chan(exit_po);
137137
let exit_ch_ptr = ptr::addr_of(exit_ch);

src/libstd/uv_iotask.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* `interact` function you can execute code in a uv callback.
66
*/
77

8-
export iotask;
8+
export IoTask;
99
export spawn_iotask;
1010
export interact;
1111
export exit;
@@ -18,14 +18,14 @@ import task::TaskBuilder;
1818
import ll = uv_ll;
1919

2020
/// Used to abstract-away direct interaction with a libuv loop.
21-
enum iotask {
22-
iotask_({
21+
enum IoTask {
22+
IoTask_({
2323
async_handle: *ll::uv_async_t,
24-
op_chan: Chan<iotask_msg>
24+
op_chan: Chan<IoTaskMsg>
2525
})
2626
}
2727

28-
fn spawn_iotask(-task: task::TaskBuilder) -> iotask {
28+
fn spawn_iotask(-task: task::TaskBuilder) -> IoTask {
2929

3030
do listen |iotask_ch| {
3131

@@ -62,9 +62,9 @@ fn spawn_iotask(-task: task::TaskBuilder) -> iotask {
6262
* module. It is not safe to send the `loop_ptr` param to this callback out
6363
* via ports/chans.
6464
*/
65-
unsafe fn interact(iotask: iotask,
65+
unsafe fn interact(iotask: IoTask,
6666
-cb: fn~(*c_void)) {
67-
send_msg(iotask, interaction(cb));
67+
send_msg(iotask, Interaction(cb));
6868
}
6969

7070
/**
@@ -74,20 +74,20 @@ unsafe fn interact(iotask: iotask,
7474
* async handle and do a sanity check to make sure that all other handles are
7575
* closed, causing a failure otherwise.
7676
*/
77-
fn exit(iotask: iotask) unsafe {
78-
send_msg(iotask, teardown_loop);
77+
fn exit(iotask: IoTask) unsafe {
78+
send_msg(iotask, TeardownLoop);
7979
}
8080

8181

8282
// INTERNAL API
8383

84-
enum iotask_msg {
85-
interaction (fn~(*libc::c_void)),
86-
teardown_loop
84+
enum IoTaskMsg {
85+
Interaction (fn~(*libc::c_void)),
86+
TeardownLoop
8787
}
8888

8989
/// Run the loop and begin handling messages
90-
fn run_loop(iotask_ch: Chan<iotask>) unsafe {
90+
fn run_loop(iotask_ch: Chan<IoTask>) unsafe {
9191

9292
let loop_ptr = ll::loop_new();
9393

@@ -100,15 +100,15 @@ fn run_loop(iotask_ch: Chan<iotask>) unsafe {
100100
ll::async_init(loop_ptr, async_handle, wake_up_cb);
101101

102102
// initialize our loop data and store it in the loop
103-
let data: iotask_loop_data = {
103+
let data: IoTaskLoopData = {
104104
async_handle: async_handle,
105105
msg_po: Port()
106106
};
107107
ll::set_data_for_uv_handle(async_handle, addr_of(data));
108108

109109
// Send out a handle through which folks can talk to us
110110
// while we dwell in the I/O loop
111-
let iotask = iotask_({
111+
let iotask = IoTask_({
112112
async_handle: async_handle,
113113
op_chan: data.msg_po.chan()
114114
});
@@ -122,13 +122,13 @@ fn run_loop(iotask_ch: Chan<iotask>) unsafe {
122122
}
123123

124124
// data that lives for the lifetime of the high-evel oo
125-
type iotask_loop_data = {
125+
type IoTaskLoopData = {
126126
async_handle: *ll::uv_async_t,
127-
msg_po: Port<iotask_msg>
127+
msg_po: Port<IoTaskMsg>
128128
};
129129

130-
fn send_msg(iotask: iotask,
131-
-msg: iotask_msg) unsafe {
130+
fn send_msg(iotask: IoTask,
131+
-msg: IoTaskMsg) unsafe {
132132
iotask.op_chan.send(msg);
133133
ll::async_send(iotask.async_handle);
134134
}
@@ -141,18 +141,18 @@ extern fn wake_up_cb(async_handle: *ll::uv_async_t,
141141
async_handle, status));
142142

143143
let loop_ptr = ll::get_loop_for_uv_handle(async_handle);
144-
let data = ll::get_data_for_uv_handle(async_handle) as *iotask_loop_data;
144+
let data = ll::get_data_for_uv_handle(async_handle) as *IoTaskLoopData;
145145
let msg_po = (*data).msg_po;
146146

147147
while msg_po.peek() {
148148
match msg_po.recv() {
149-
interaction(cb) => cb(loop_ptr),
150-
teardown_loop => begin_teardown(data)
149+
Interaction(cb) => cb(loop_ptr),
150+
TeardownLoop => begin_teardown(data)
151151
}
152152
}
153153
}
154154

155-
fn begin_teardown(data: *iotask_loop_data) unsafe {
155+
fn begin_teardown(data: *IoTaskLoopData) unsafe {
156156
log(debug, ~"iotask begin_teardown() called, close async_handle");
157157
let async_handle = (*data).async_handle;
158158
ll::close(async_handle as *c_void, tear_down_close_cb);
@@ -171,19 +171,19 @@ mod test {
171171
extern fn async_close_cb(handle: *ll::uv_async_t) unsafe {
172172
log(debug, fmt!("async_close_cb handle %?", handle));
173173
let exit_ch = (*(ll::get_data_for_uv_handle(handle)
174-
as *ah_data)).exit_ch;
174+
as *AhData)).exit_ch;
175175
core::comm::send(exit_ch, ());
176176
}
177177
extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int)
178178
unsafe {
179179
log(debug, fmt!("async_handle_cb handle %? status %?",handle,status));
180180
ll::close(handle, async_close_cb);
181181
}
182-
type ah_data = {
183-
iotask: iotask,
182+
type AhData = {
183+
iotask: IoTask,
184184
exit_ch: comm::Chan<()>
185185
};
186-
fn impl_uv_iotask_async(iotask: iotask) unsafe {
186+
fn impl_uv_iotask_async(iotask: IoTask) unsafe {
187187
let async_handle = ll::async_t();
188188
let ah_ptr = ptr::addr_of(async_handle);
189189
let exit_po = core::comm::Port::<()>();
@@ -203,8 +203,8 @@ mod test {
203203

204204
// this fn documents the bear minimum neccesary to roll your own
205205
// high_level_loop
206-
unsafe fn spawn_test_loop(exit_ch: comm::Chan<()>) -> iotask {
207-
let iotask_port = comm::Port::<iotask>();
206+
unsafe fn spawn_test_loop(exit_ch: comm::Chan<()>) -> IoTask {
207+
let iotask_port = comm::Port::<IoTask>();
208208
let iotask_ch = comm::Chan(iotask_port);
209209
do task::spawn_sched(task::ManualThreads(1u)) {
210210
run_loop(iotask_ch);

src/libstd/uv_ll.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* with per-platform, generated source files from rust-bindgen.
2121
*/
2222

23+
#[allow(non_camel_case_types)] // C types
24+
2325
import libc::size_t;
2426
import comm = core::comm;
2527
import ptr::to_unsafe_ptr;

0 commit comments

Comments
 (0)