]> git.lizzy.rs Git - rust.git/commitdiff
Handle fallout in libnative
authorKevin Ballard <kevin@sb.org>
Sun, 4 May 2014 07:21:44 +0000 (00:21 -0700)
committerKevin Ballard <kevin@sb.org>
Thu, 8 May 2014 19:06:22 +0000 (12:06 -0700)
API Changes:

- GetAddrInfoRequest::run() returns Result<Vec<..>, ..>
- Process::spawn() returns Result(.., Vec<..>), ..>

src/libnative/io/addrinfo.rs
src/libnative/io/mod.rs
src/libnative/io/process.rs
src/libstd/rt/rtio.rs

index 71944202205ffcd47118e3f6e524f3c8ad739fcd..57b87f21521e8221844e230b806f2888fcf12f45 100644 (file)
@@ -22,7 +22,7 @@
 
 impl GetAddrInfoRequest {
     pub fn run(host: Option<&str>, servname: Option<&str>,
-               hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError> {
+               hint: Option<ai::Hint>) -> Result<Vec<ai::Info>, IoError> {
         assert!(host.is_some() || servname.is_some());
 
         let c_host = host.map_or(unsafe { CString::new(null(), true) }, |x| x.to_c_str());
@@ -80,7 +80,7 @@ pub fn run(host: Option<&str>, servname: Option<&str>,
 
         unsafe { freeaddrinfo(res); }
 
-        Ok(addrs.move_iter().collect())
+        Ok(addrs)
     }
 }
 
index 58fcd60f13815495f7ba58b4ff9e34269f31b467..f2c2c66e1425fe521be0ff897e2a17c10b98b567 100644 (file)
@@ -194,7 +194,7 @@ fn unix_connect(&mut self, path: &CString,
         })
     }
     fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
-                          hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> {
+                          hint: Option<ai::Hint>) -> IoResult<Vec<ai::Info>> {
         addrinfo::GetAddrInfoRequest::run(host, servname, hint)
     }
 
@@ -260,7 +260,7 @@ fn timer_init(&mut self) -> IoResult<Box<RtioTimer:Send>> {
     }
     fn spawn(&mut self, config: ProcessConfig)
             -> IoResult<(Box<RtioProcess:Send>,
-                         ~[Option<Box<RtioPipe:Send>>])> {
+                         Vec<Option<Box<RtioPipe:Send>>>)> {
         process::Process::spawn(config).map(|(p, io)| {
             (box p as Box<RtioProcess:Send>,
              io.move_iter().map(|p| p.map(|p| {
index efdab990d18223f1e73bd4daf5d7227cab089ff6..c83af20d1d84eac884ed7dd2b83372f2500f40a8 100644 (file)
@@ -67,7 +67,7 @@ impl Process {
     ///     os pipe instead. This process takes ownership of these file
     ///     descriptors, closing them upon destruction of the process.
     pub fn spawn(config: p::ProcessConfig)
-        -> Result<(Process, ~[Option<file::FileDesc>]), io::IoError>
+        -> Result<(Process, Vec<Option<file::FileDesc>>), io::IoError>
     {
         // right now we only handle stdin/stdout/stderr.
         if config.extra_io.len() > 0 {
@@ -117,7 +117,7 @@ fn get_io(io: p::StdioContainer, ret: &mut Vec<Option<file::FileDesc>>)
                         exit_code: None,
                         exit_signal: None,
                     },
-                    ret_io.move_iter().collect()))
+                    ret_io))
             }
             Err(e) => Err(e)
         }
index eaf194b89cbf72854e54320a776520ae17bc0e73..ccde8d9c96af08cf15bcc141624531a4d5009aab 100644 (file)
@@ -191,7 +191,7 @@ fn fs_utime(&mut self, src: &CString, atime: u64, mtime: u64) ->
     fn timer_init(&mut self) -> IoResult<Box<RtioTimer:Send>>;
     fn spawn(&mut self, config: ProcessConfig)
             -> IoResult<(Box<RtioProcess:Send>,
-                         ~[Option<Box<RtioPipe:Send>>])>;
+                         Vec<Option<Box<RtioPipe:Send>>>)>;
     fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>;
     fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<RtioPipe:Send>>;
     fn tty_open(&mut self, fd: c_int, readable: bool)