Skip to content

Commit 8d704f7

Browse files
committed
Fix for IO changes
1 parent ab617f4 commit 8d704f7

9 files changed

Lines changed: 32 additions & 32 deletions

File tree

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::HashMap;
22
use std::error;
3-
use std::io::IoError;
3+
use std::old_io::IoError;
44
use std::fmt;
55
use std::result;
66

src/io.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use openssl::ssl::{SslStream, MaybeSslStream};
2-
use std::io::BufferedStream;
3-
use std::io::net::ip::Port;
4-
use std::io::net::tcp::TcpStream;
5-
use std::io::net::pipe::UnixStream;
6-
use std::io::{IoResult, Stream};
2+
use std::old_io::BufferedStream;
3+
use std::old_io::net::ip::Port;
4+
use std::old_io::net::tcp::TcpStream;
5+
use std::old_io::net::pipe::UnixStream;
6+
use std::old_io::{IoResult, Stream};
77

88
use {ConnectParams, SslMode, ConnectTarget, ConnectError};
99
use message;
@@ -44,10 +44,10 @@ impl Reader for InternalStream {
4444
}
4545

4646
impl Writer for InternalStream {
47-
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
47+
fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
4848
match *self {
49-
InternalStream::Tcp(ref mut s) => s.write(buf),
50-
InternalStream::Unix(ref mut s) => s.write(buf),
49+
InternalStream::Tcp(ref mut s) => s.write_all(buf),
50+
InternalStream::Unix(ref mut s) => s.write_all(buf),
5151
}
5252
}
5353

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ use std::cell::{Cell, RefCell};
7272
use std::cmp::max;
7373
use std::collections::{RingBuf, HashMap};
7474
use std::fmt;
75-
use std::io::{BufferedStream, IoResult, IoError, IoErrorKind};
76-
use std::io::net::ip::Port;
75+
use std::old_io::{BufferedStream, IoResult, IoError, IoErrorKind};
76+
use std::old_io::net::ip::Port;
7777
use std::mem;
7878
use std::result;
7979
use std::time::Duration;
@@ -283,7 +283,7 @@ impl<'conn> Notifications<'conn> {
283283
///
284284
/// ```rust,no_run
285285
/// # #![allow(unstable)]
286-
/// use std::io::{IoError, IoErrorKind};
286+
/// use std::old_io::{IoError, IoErrorKind};
287287
/// use std::time::Duration;
288288
///
289289
/// use postgres::Error;
@@ -1901,7 +1901,7 @@ impl<'a> CopyInStatement<'a> {
19011901
}
19021902

19031903
let mut buf = vec![];
1904-
let _ = buf.write(b"PGCOPY\n\xff\r\n\x00");
1904+
let _ = buf.write_all(b"PGCOPY\n\xff\r\n\x00");
19051905
let _ = buf.write_be_i32(0);
19061906
let _ = buf.write_be_i32(0);
19071907

@@ -1918,7 +1918,7 @@ impl<'a> CopyInStatement<'a> {
19181918
}
19191919
Ok(Some(val)) => {
19201920
let _ = buf.write_be_i32(val.len() as i32);
1921-
let _ = buf.write(&*val);
1921+
let _ = buf.write_all(&*val);
19221922
}
19231923
Err(err) => {
19241924
// FIXME this is not the right way to handle this

src/message.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::io::{IoResult, IoError, OtherIoError, ByRefReader};
2-
use std::io::util::LimitReader;
1+
use std::old_io::{IoResult, IoError, OtherIoError, ByRefReader};
2+
use std::old_io::util::LimitReader;
33
use std::mem;
44

55
use io::Timeout;
@@ -139,7 +139,7 @@ trait WriteCStr {
139139

140140
impl<W: Writer> WriteCStr for W {
141141
fn write_cstr(&mut self, s: &str) -> IoResult<()> {
142-
try!(self.write(s.as_bytes()));
142+
try!(self.write_all(s.as_bytes()));
143143
self.write_u8(0)
144144
}
145145
}
@@ -171,7 +171,7 @@ impl<W: Writer> WriteMessage for W {
171171
None => try!(buf.write_be_i32(-1)),
172172
Some(ref value) => {
173173
try!(buf.write_be_i32(value.len() as i32));
174-
try!(buf.write(&**value));
174+
try!(buf.write_all(&**value));
175175
}
176176
}
177177
}
@@ -193,7 +193,7 @@ impl<W: Writer> WriteMessage for W {
193193
}
194194
CopyData { data } => {
195195
ident = Some(b'd');
196-
try!(buf.write(data));
196+
try!(buf.write_all(data));
197197
}
198198
CopyDone => ident = Some(b'c'),
199199
CopyFail { message } => {
@@ -246,7 +246,7 @@ impl<W: Writer> WriteMessage for W {
246246

247247
// add size of length value
248248
try!(self.write_be_i32((buf.len() + mem::size_of::<i32>()) as i32));
249-
try!(self.write(&*buf));
249+
try!(self.write_all(&*buf));
250250

251251
Ok(())
252252
}

src/types/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Traits dealing with Postgres data types
22
use serialize::json;
33
use std::collections::HashMap;
4-
use std::io::net::ip::IpAddr;
4+
use std::old_io::net::ip::IpAddr;
55
use std::fmt;
66

77
use Result;
@@ -525,13 +525,13 @@ impl RawToSql for bool {
525525

526526
impl RawToSql for Vec<u8> {
527527
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {
528-
Ok(try!(w.write(&**self)))
528+
Ok(try!(w.write_all(&**self)))
529529
}
530530
}
531531

532532
impl RawToSql for String {
533533
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {
534-
Ok(try!(w.write(self.as_bytes())))
534+
Ok(try!(w.write_all(self.as_bytes())))
535535
}
536536
}
537537

@@ -557,15 +557,15 @@ impl RawToSql for IpAddr {
557557
fn raw_to_sql<W: Writer>(&self, _: &Type, raw: &mut W) -> Result<()> {
558558
match *self {
559559
IpAddr::Ipv4Addr(a, b, c, d) => {
560-
try!(raw.write(&[2, // family
560+
try!(raw.write_all(&[2, // family
561561
32, // bits
562562
0, // is_cidr
563563
4, // nb
564564
a, b, c, d // addr
565565
]));
566566
}
567567
IpAddr::Ipv6Addr(a, b, c, d, e, f, g, h) => {
568-
try!(raw.write(&[3, // family
568+
try!(raw.write_all(&[3, // family
569569
128, // bits
570570
0, // is_cidr
571571
16, // nb
@@ -655,12 +655,12 @@ impl ToSql for HashMap<String, Option<String>> {
655655

656656
for (key, val) in self.iter() {
657657
try!(buf.write_be_i32(key.len() as i32));
658-
try!(buf.write(key.as_bytes()));
658+
try!(buf.write_all(key.as_bytes()));
659659

660660
match *val {
661661
Some(ref val) => {
662662
try!(buf.write_be_i32(val.len() as i32));
663-
try!(buf.write(val.as_bytes()));
663+
try!(buf.write_all(val.as_bytes()));
664664
}
665665
None => try!(buf.write_be_i32(-1))
666666
}

src/types/uuid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from_raw_from_impl!(Type::Uuid; Uuid);
1818

1919
impl RawToSql for Uuid {
2020
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {
21-
Ok(try!(w.write(self.as_bytes())))
21+
Ok(try!(w.write_all(self.as_bytes())))
2222
}
2323
}
2424

src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::io::IoResult;
1+
use std::old_io::IoResult;
22

33
pub fn comma_join<'a, W, I>(writer: &mut W, mut strs: I) -> IoResult<()>
44
where W: Writer, I: Iterator<Item=&'a str> {

tests/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ extern crate openssl;
88

99
use openssl::ssl::SslContext;
1010
use openssl::ssl::SslMethod;
11-
use std::io::{IoError, IoErrorKind};
12-
use std::io::timer;
11+
use std::old_io::{IoError, IoErrorKind};
12+
use std::old_io::timer;
1313
use std::time::Duration;
1414
use std::thread::Thread;
1515

tests/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::f32;
44
use std::f64;
55
use std::fmt;
66
use std::num::Float;
7-
use std::io::net::ip::IpAddr;
7+
use std::old_io::net::ip::IpAddr;
88

99
use postgres::{Connection, SslMode};
1010
use postgres::types::{ToSql, FromSql};

0 commit comments

Comments
 (0)