diff options
| author | Kevin Ballard <kevin@sb.org> | 2014-05-04 00:44:19 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2014-05-08 12:06:22 -0700 |
| commit | fa82ef23b800a10209732e1af2558eea87e218e8 (patch) | |
| tree | ffaff1b3f37784cf8478f9da6b69648cf02591cd | |
| parent | fac0d4e135540a4cb45b49a018d9c1e86fe7eea2 (diff) | |
Handle fallout in librustuv
API Changes: - GetAddrInfoRequest::run() returns Result<Vec<..>, ..> - Process::spawn() returns Result<(.., Vec<..>), ..>
| -rw-r--r-- | src/librustuv/addrinfo.rs | 6 | ||||
| -rw-r--r-- | src/librustuv/process.rs | 5 | ||||
| -rw-r--r-- | src/librustuv/uvio.rs | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/librustuv/addrinfo.rs b/src/librustuv/addrinfo.rs index 94a084fe055..4766630b0f4 100644 --- a/src/librustuv/addrinfo.rs +++ b/src/librustuv/addrinfo.rs @@ -33,7 +33,7 @@ pub struct GetAddrInfoRequest; impl GetAddrInfoRequest { pub fn run(loop_: &Loop, node: Option<&str>, service: Option<&str>, - hints: Option<ai::Hint>) -> Result<~[ai::Info], UvError> { + hints: Option<ai::Hint>) -> Result<Vec<ai::Info>, UvError> { assert!(node.is_some() || service.is_some()); let (_c_node, c_node_ptr) = match node { Some(n) => { @@ -134,7 +134,7 @@ fn each_ai_flag(_f: |c_int, ai::Flag|) { } // Traverse the addrinfo linked list, producing a vector of Rust socket addresses -pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] { +pub fn accum_addrinfo(addr: &Addrinfo) -> Vec<ai::Info> { unsafe { let mut addr = addr.handle; @@ -180,6 +180,6 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] { } } - return addrs.move_iter().collect(); + addrs } } diff --git a/src/librustuv/process.rs b/src/librustuv/process.rs index d744607050f..d671e20868c 100644 --- a/src/librustuv/process.rs +++ b/src/librustuv/process.rs @@ -40,7 +40,8 @@ impl Process { /// Returns either the corresponding process object or an error which /// occurred. pub fn spawn(io_loop: &mut UvIoFactory, config: process::ProcessConfig) - -> Result<(Box<Process>, ~[Option<PipeWatcher>]), UvError> { + -> Result<(Box<Process>, Vec<Option<PipeWatcher>>), UvError> + { let cwd = config.cwd.map(|s| s.to_c_str()); let mut io = vec![config.stdin, config.stdout, config.stderr]; for slot in config.extra_io.iter() { @@ -102,7 +103,7 @@ impl Process { }); match ret { - Ok(p) => Ok((p, ret_io.move_iter().collect())), + Ok(p) => Ok((p, ret_io)), Err(e) => Err(e), } } diff --git a/src/librustuv/uvio.rs b/src/librustuv/uvio.rs index 17a64fdb517..50258c2583c 100644 --- a/src/librustuv/uvio.rs +++ b/src/librustuv/uvio.rs @@ -178,7 +178,7 @@ impl IoFactory for UvIoFactory { } fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, - hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError> { + hint: Option<ai::Hint>) -> Result<Vec<ai::Info>, IoError> { let r = GetAddrInfoRequest::run(&self.loop_, host, servname, hint); r.map_err(uv_error_to_io_error) } @@ -272,7 +272,7 @@ impl IoFactory for UvIoFactory { fn spawn(&mut self, config: ProcessConfig) -> Result<(Box<rtio::RtioProcess:Send>, - ~[Option<Box<rtio::RtioPipe:Send>>]), + Vec<Option<Box<rtio::RtioPipe:Send>>>), IoError> { match Process::spawn(self, config) { |
