std::rt: Some I/O cleanup

This commit is contained in:
Brian Anderson 2013-09-04 16:31:55 -07:00
parent d84a7b5ae3
commit b3f7f758b1
2 changed files with 10 additions and 7 deletions

View File

@ -139,15 +139,17 @@ fn native_handle(&self) -> *uvll::uv_fs_t {
match self { &FsRequest(ptr) => ptr }
}
}
fn sync_cleanup(loop_: &Loop, result: int)
-> Result<int, UvError> {
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<int, UvError> {
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)

View File

@ -132,7 +132,8 @@ fn native_handle(&self) -> *uvll::uv_loop_t {
pub type UdpSendCallback = ~fn(UdpWatcher, Option<UvError>);
/// 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<ReadCallback>,
write_cb: Option<ConnectionCallback>,