Fix feature'd impls

This commit is contained in:
Steven Fackler 2015-02-14 20:04:57 -08:00
parent b34e5f31de
commit 6b2f26e207
3 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
use serialize::json;
use {Result, Error};
use types::{RawFromSql, RawToSql, Type};
use types::{FromSql, RawToSql, Type};
impl FromSql for json::Json {
fn from_sql<R: Reader>(ty: &Type, raw: &mut R) -> Result<json::Json> {

View File

@ -1,6 +1,6 @@
use time::Timespec;
use Result;
use types::{RawFromSql, Type, RawToSql};
use types::{Type, FromSql, RawToSql};
const USEC_PER_SEC: i64 = 1_000_000;
const NSEC_PER_USEC: i64 = 1_000;
@ -8,8 +8,8 @@ const NSEC_PER_USEC: i64 = 1_000;
// Number of seconds from 1970-01-01 to 2000-01-01
const TIME_SEC_CONVERSION: i64 = 946684800;
impl RawFromSql for Timespec {
fn raw_from_sql<R: Reader>(_: &Type, raw: &mut R) -> Result<Timespec> {
impl FromSql for Timespec {
fn from_sql<R: Reader>(_: &Type, raw: &mut R) -> Result<Timespec> {
let t = try!(raw.read_be_i64());
let mut sec = t / USEC_PER_SEC + TIME_SEC_CONVERSION;
let mut usec = t % USEC_PER_SEC;
@ -21,9 +21,9 @@ impl RawFromSql for Timespec {
Ok(Timespec::new(sec, (usec * NSEC_PER_USEC) as i32))
}
}
from_raw_from_impl!(Type::Timestamp, Type::TimestampTZ; Timespec);
accepts!(Type::Timestamp, Type::TimestampTZ);
}
impl RawToSql for Timespec {
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {

View File

@ -1,20 +1,20 @@
extern crate uuid;
use self::uuid::Uuid;
use types::{RawFromSql, ToSql, RawToSql, Type};
use types::{FromSql, ToSql, RawToSql, Type};
use Error;
use Result;
impl RawFromSql for Uuid {
fn raw_from_sql<R: Reader>(_: &Type, raw: &mut R) -> Result<Uuid> {
impl FromSql for Uuid {
fn from_sql<R: Reader>(_: &Type, raw: &mut R) -> Result<Uuid> {
match Uuid::from_bytes(&*try!(raw.read_to_end())) {
Some(u) => Ok(u),
None => Err(Error::BadResponse),
}
}
}
from_raw_from_impl!(Type::Uuid; Uuid);
accepts!(Type::Uuid);
}
impl RawToSql for Uuid {
fn raw_to_sql<W: Writer>(&self, _: &Type, w: &mut W) -> Result<()> {