Skip to content

Commit fa82ef2

Browse files
committed
Handle fallout in librustuv
API Changes: - GetAddrInfoRequest::run() returns Result<Vec<..>, ..> - Process::spawn() returns Result<(.., Vec<..>), ..>
1 parent fac0d4e commit fa82ef2

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/librustuv/addrinfo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct GetAddrInfoRequest;
3333

3434
impl GetAddrInfoRequest {
3535
pub fn run(loop_: &Loop, node: Option<&str>, service: Option<&str>,
36-
hints: Option<ai::Hint>) -> Result<~[ai::Info], UvError> {
36+
hints: Option<ai::Hint>) -> Result<Vec<ai::Info>, UvError> {
3737
assert!(node.is_some() || service.is_some());
3838
let (_c_node, c_node_ptr) = match node {
3939
Some(n) => {
@@ -134,7 +134,7 @@ fn each_ai_flag(_f: |c_int, ai::Flag|) {
134134
}
135135

136136
// Traverse the addrinfo linked list, producing a vector of Rust socket addresses
137-
pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] {
137+
pub fn accum_addrinfo(addr: &Addrinfo) -> Vec<ai::Info> {
138138
unsafe {
139139
let mut addr = addr.handle;
140140

@@ -180,6 +180,6 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] {
180180
}
181181
}
182182

183-
return addrs.move_iter().collect();
183+
addrs
184184
}
185185
}

src/librustuv/process.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ impl Process {
4040
/// Returns either the corresponding process object or an error which
4141
/// occurred.
4242
pub fn spawn(io_loop: &mut UvIoFactory, config: process::ProcessConfig)
43-
-> Result<(Box<Process>, ~[Option<PipeWatcher>]), UvError> {
43+
-> Result<(Box<Process>, Vec<Option<PipeWatcher>>), UvError>
44+
{
4445
let cwd = config.cwd.map(|s| s.to_c_str());
4546
let mut io = vec![config.stdin, config.stdout, config.stderr];
4647
for slot in config.extra_io.iter() {
@@ -102,7 +103,7 @@ impl Process {
102103
});
103104

104105
match ret {
105-
Ok(p) => Ok((p, ret_io.move_iter().collect())),
106+
Ok(p) => Ok((p, ret_io)),
106107
Err(e) => Err(e),
107108
}
108109
}

src/librustuv/uvio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl IoFactory for UvIoFactory {
178178
}
179179

180180
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
181-
hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError> {
181+
hint: Option<ai::Hint>) -> Result<Vec<ai::Info>, IoError> {
182182
let r = GetAddrInfoRequest::run(&self.loop_, host, servname, hint);
183183
r.map_err(uv_error_to_io_error)
184184
}
@@ -272,7 +272,7 @@ impl IoFactory for UvIoFactory {
272272

273273
fn spawn(&mut self, config: ProcessConfig)
274274
-> Result<(Box<rtio::RtioProcess:Send>,
275-
~[Option<Box<rtio::RtioPipe:Send>>]),
275+
Vec<Option<Box<rtio::RtioPipe:Send>>>),
276276
IoError>
277277
{
278278
match Process::spawn(self, config) {

0 commit comments

Comments
 (0)