Fix for IO changes

This commit is contained in:
Steven Fackler 2015-01-28 08:52:33 -08:00
parent ab617f4df1
commit 8d704f71ce
9 changed files with 32 additions and 32 deletions

View File

@ -1,6 +1,6 @@
use std::collections::HashMap;
use std::error;
use std::io::IoError;
use std::old_io::IoError;
use std::fmt;
use std::result;

View File

@ -1,9 +1,9 @@
use openssl::ssl::{SslStream, MaybeSslStream};
use std::io::BufferedStream;
use std::io::net::ip::Port;
use std::io::net::tcp::TcpStream;
use std::io::net::pipe::UnixStream;
use std::io::{IoResult, Stream};
use std::old_io::BufferedStream;
use std::old_io::net::ip::Port;
use std::old_io::net::tcp::TcpStream;
use std::old_io::net::pipe::UnixStream;
use std::old_io::{IoResult, Stream};
use {ConnectParams, SslMode, ConnectTarget, ConnectError};
use message;
@ -44,10 +44,10 @@ impl Reader for InternalStream {
}
impl Writer for InternalStream {
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
match *self {
InternalStream::Tcp(ref mut s) => s.write(buf),
InternalStream::Unix(ref mut s) => s.write(buf),
InternalStream::Tcp(ref mut s) => s.write_all(buf),
InternalStream::Unix(ref mut s) => s.write_all(buf),
}
}

View File

@ -72,8 +72,8 @@ use std::cell::{Cell, RefCell};
use std::cmp::max;
use std::collections::{RingBuf, HashMap};
use std::fmt;
use std::io::{BufferedStream, IoResult, IoError, IoErrorKind};
use std::io::net::ip::Port;
use std::old_io::{BufferedStream, IoResult, IoError, IoErrorKind};
use std::old_io::net::ip::Port;
use std::mem;
use std::result;
use std::time::Duration;
@ -283,7 +283,7 @@ impl<'conn> Notifications<'conn> {
///
/// ```rust,no_run
/// # #![allow(unstable)]
/// use std::io::{IoError, IoErrorKind};
/// use std::old_io::{IoError, IoErrorKind};
/// use std::time::Duration;
///
/// use postgres::Error;
@ -1901,7 +1901,7 @@ impl<'a> CopyInStatement<'a> {
}
let mut buf = vec![];
let _ = buf.write(b"PGCOPY\n\xff\r\n\x00");
let _ = buf.write_all(b"PGCOPY\n\xff\r\n\x00");
let _ = buf.write_be_i32(0);
let _ = buf.write_be_i32(0);
@ -1918,7 +1918,7 @@ impl<'a> CopyInStatement<'a> {
}
Ok(Some(val)) => {
let _ = buf.write_be_i32(val.len() as i32);
let _ = buf.write(&*val);
let _ = buf.write_all(&*val);
}
Err(err) => {
// FIXME this is not the right way to handle this

View File

@ -1,5 +1,5 @@
use std::io::{IoResult, IoError, OtherIoError, ByRefReader};
use std::io::util::LimitReader;
use std::old_io::{IoResult, IoError, OtherIoError, ByRefReader};
use std::old_io::util::LimitReader;
use std::mem;
use io::Timeout;
@ -139,7 +139,7 @@ trait WriteCStr {
impl<W: Writer> WriteCStr for W {
fn write_cstr(&mut self, s: &str) -> IoResult<()> {
try!(self.write(s.as_bytes()));
try!(self.write_all(s.as_bytes()));
self.write_u8(0)
}
}
@ -171,7 +171,7 @@ impl<W: Writer> WriteMessage for W {
None => try!(buf.write_be_i32(-1)),
Some(ref value) => {
try!(buf.write_be_i32(value.len() as i32));
try!(buf.write(&**value));
try!(buf.write_all(&**value));
}
}
}
@ -193,7 +193,7 @@ impl<W: Writer> WriteMessage for W {
}
CopyData { data } => {
ident = Some(b'd');
try!(buf.write(data));
try!(buf.write_all(data));
}
CopyDone => ident = Some(b'c'),
CopyFail { message } => {
@ -246,7 +246,7 @@ impl<W: Writer> WriteMessage for W {
// add size of length value
try!(self.write_be_i32((buf.len() + mem::size_of::<i32>()) as i32));
try!(self.write(&*buf));
try!(self.write_all(&*buf));
Ok(())
}

View File

@ -1,7 +1,7 @@
//! Traits dealing with Postgres data types
use serialize::json;
use std::collections::HashMap;
use std::io::net::ip::IpAddr;
use std::old_io::net::ip::IpAddr;
use std::fmt;
use Result;
@ -525,13 +525,13 @@ impl RawToSql for bool {
impl RawToSql for Vec<u8> {
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {
Ok(try!(w.write(&**self)))
Ok(try!(w.write_all(&**self)))
}
}
impl RawToSql for String {
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {
Ok(try!(w.write(self.as_bytes())))
Ok(try!(w.write_all(self.as_bytes())))
}
}
@ -557,7 +557,7 @@ impl RawToSql for IpAddr {
fn raw_to_sql<W: Writer>(&self, _: &Type, raw: &mut W) -> Result<()> {
match *self {
IpAddr::Ipv4Addr(a, b, c, d) => {
try!(raw.write(&[2, // family
try!(raw.write_all(&[2, // family
32, // bits
0, // is_cidr
4, // nb
@ -565,7 +565,7 @@ impl RawToSql for IpAddr {
]));
}
IpAddr::Ipv6Addr(a, b, c, d, e, f, g, h) => {
try!(raw.write(&[3, // family
try!(raw.write_all(&[3, // family
128, // bits
0, // is_cidr
16, // nb
@ -655,12 +655,12 @@ impl ToSql for HashMap<String, Option<String>> {
for (key, val) in self.iter() {
try!(buf.write_be_i32(key.len() as i32));
try!(buf.write(key.as_bytes()));
try!(buf.write_all(key.as_bytes()));
match *val {
Some(ref val) => {
try!(buf.write_be_i32(val.len() as i32));
try!(buf.write(val.as_bytes()));
try!(buf.write_all(val.as_bytes()));
}
None => try!(buf.write_be_i32(-1))
}

View File

@ -18,7 +18,7 @@ from_raw_from_impl!(Type::Uuid; Uuid);
impl RawToSql for Uuid {
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {
Ok(try!(w.write(self.as_bytes())))
Ok(try!(w.write_all(self.as_bytes())))
}
}

View File

@ -1,4 +1,4 @@
use std::io::IoResult;
use std::old_io::IoResult;
pub fn comma_join<'a, W, I>(writer: &mut W, mut strs: I) -> IoResult<()>
where W: Writer, I: Iterator<Item=&'a str> {

View File

@ -8,8 +8,8 @@ extern crate openssl;
use openssl::ssl::SslContext;
use openssl::ssl::SslMethod;
use std::io::{IoError, IoErrorKind};
use std::io::timer;
use std::old_io::{IoError, IoErrorKind};
use std::old_io::timer;
use std::time::Duration;
use std::thread::Thread;

View File

@ -4,7 +4,7 @@ use std::f32;
use std::f64;
use std::fmt;
use std::num::Float;
use std::io::net::ip::IpAddr;
use std::old_io::net::ip::IpAddr;
use postgres::{Connection, SslMode};
use postgres::types::{ToSql, FromSql};