File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use serialize:: json;
22
33use { Result , Error } ;
4- use types:: { RawFromSql , RawToSql , Type } ;
4+ use types:: { FromSql , RawToSql , Type } ;
55
66impl FromSql for json:: Json {
77 fn from_sql < R : Reader > ( ty : & Type , raw : & mut R ) -> Result < json:: Json > {
Original file line number Diff line number Diff line change 11use time:: Timespec ;
22use Result ;
3- use types:: { RawFromSql , Type , RawToSql } ;
3+ use types:: { Type , FromSql , RawToSql } ;
44
55const USEC_PER_SEC : i64 = 1_000_000 ;
66const NSEC_PER_USEC : i64 = 1_000 ;
77
88// Number of seconds from 1970-01-01 to 2000-01-01
99const TIME_SEC_CONVERSION : i64 = 946684800 ;
1010
11- impl RawFromSql for Timespec {
12- fn raw_from_sql < R : Reader > ( _: & Type , raw : & mut R ) -> Result < Timespec > {
11+ impl FromSql for Timespec {
12+ fn from_sql < R : Reader > ( _: & Type , raw : & mut R ) -> Result < Timespec > {
1313 let t = try!( raw. read_be_i64 ( ) ) ;
1414 let mut sec = t / USEC_PER_SEC + TIME_SEC_CONVERSION ;
1515 let mut usec = t % USEC_PER_SEC ;
@@ -21,9 +21,9 @@ impl RawFromSql for Timespec {
2121
2222 Ok ( Timespec :: new ( sec, ( usec * NSEC_PER_USEC ) as i32 ) )
2323 }
24- }
2524
26- from_raw_from_impl ! ( Type :: Timestamp , Type :: TimestampTZ ; Timespec ) ;
25+ accepts ! ( Type :: Timestamp , Type :: TimestampTZ ) ;
26+ }
2727
2828impl RawToSql for Timespec {
2929 fn raw_to_sql < W : Writer > ( & self , _: & Type , w : & mut W ) -> Result < ( ) > {
Original file line number Diff line number Diff line change 11extern crate uuid;
22
33use self :: uuid:: Uuid ;
4- use types:: { RawFromSql , ToSql , RawToSql , Type } ;
4+ use types:: { FromSql , ToSql , RawToSql , Type } ;
55use Error ;
66use Result ;
77
8- impl RawFromSql for Uuid {
9- fn raw_from_sql < R : Reader > ( _: & Type , raw : & mut R ) -> Result < Uuid > {
8+ impl FromSql for Uuid {
9+ fn from_sql < R : Reader > ( _: & Type , raw : & mut R ) -> Result < Uuid > {
1010 match Uuid :: from_bytes ( & * try!( raw. read_to_end ( ) ) ) {
1111 Some ( u) => Ok ( u) ,
1212 None => Err ( Error :: BadResponse ) ,
1313 }
1414 }
15- }
1615
17- from_raw_from_impl ! ( Type :: Uuid ; Uuid ) ;
16+ accepts ! ( Type :: Uuid ) ;
17+ }
1818
1919impl RawToSql for Uuid {
2020 fn raw_to_sql < W : Writer > ( & self , _: & Type , w : & mut W ) -> Result < ( ) > {
You can’t perform that action at this time.
0 commit comments