From b3f7f758b1f3df8c1d2ded808492b452e4b0e1a0 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 4 Sep 2013 16:31:55 -0700 Subject: std::rt: Some I/O cleanup --- src/libstd/rt/uv/file.rs | 14 ++++++++------ src/libstd/rt/uv/mod.rs | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/uv/file.rs b/src/libstd/rt/uv/file.rs index eaf70242440..440b5c395c7 100644 --- a/src/libstd/rt/uv/file.rs +++ b/src/libstd/rt/uv/file.rs @@ -139,15 +139,17 @@ impl NativeHandle<*uvll::uv_fs_t> for FsRequest { match self { &FsRequest(ptr) => ptr } } } - fn sync_cleanup(loop_: &Loop, result: int) - -> Result { - match status_to_maybe_uv_error_with_loop(loop_.native_handle(), result as i32) { - Some(err) => Err(err), - None => Ok(result) - } + +fn sync_cleanup(loop_: &Loop, result: int) + -> Result { + match status_to_maybe_uv_error_with_loop(loop_.native_handle(), result as i32) { + Some(err) => Err(err), + None => Ok(result) } +} pub struct FileDescriptor(c_int); + impl FileDescriptor { fn new(fd: c_int) -> FileDescriptor { FileDescriptor(fd) diff --git a/src/libstd/rt/uv/mod.rs b/src/libstd/rt/uv/mod.rs index 75b9a5ac553..ea4562068b4 100644 --- a/src/libstd/rt/uv/mod.rs +++ b/src/libstd/rt/uv/mod.rs @@ -132,7 +132,8 @@ pub type UdpReceiveCallback = ~fn(UdpWatcher, int, Buf, SocketAddr, uint, Option pub type UdpSendCallback = ~fn(UdpWatcher, Option); -/// Callbacks used by StreamWatchers, set as custom data on the foreign handle +/// Callbacks used by StreamWatchers, set as custom data on the foreign handle. +/// XXX: Would be better not to have all watchers allocate room for all callback types. struct WatcherData { read_cb: Option, write_cb: Option, -- cgit 1.4.1-3-g733a5