5252#![ doc( html_root_url="https://sfackler.github.io/doc" ) ]
5353#![ feature( plugin, unsafe_destructor, slicing_syntax, old_orphan_check) ]
5454#![ warn( missing_docs) ]
55+ #![ allow( unstable) ]
5556
5657#[ macro_use]
5758extern crate log;
@@ -374,7 +375,7 @@ pub fn cancel_query<T>(params: T, ssl: &SslMode, data: CancelData)
374375
375376struct InnerConnection {
376377 stream : BufferedStream < MaybeSslStream < InternalStream > > ,
377- next_stmt_id : uint ,
378+ next_stmt_id : usize ,
378379 notice_handler : Box < NoticeHandler > ,
379380 notifications : RingBuf < Notification > ,
380381 cancel_data : CancelData ,
@@ -666,7 +667,7 @@ impl InnerConnection {
666667 fn set_type_names < ' a , I > ( & mut self , mut it : I ) -> Result < ( ) >
667668 where I : Iterator < Item =& ' a mut Type > {
668669 for ty in it {
669- if let & Type :: Unknown { oid, ref mut name } = ty {
670+ if let & mut Type :: Unknown { oid, ref mut name } = ty {
670671 * name = try!( self . get_type_name ( oid) ) ;
671672 }
672673 }
@@ -958,7 +959,7 @@ impl Connection {
958959 /// or execution of the statement.
959960 ///
960961 /// On success, returns the number of rows modified or 0 if not applicable.
961- pub fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < uint > {
962+ pub fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < usize > {
962963 let ( param_types, result_desc) = try!( self . conn . borrow_mut ( ) . raw_prepare ( "" , query) ) ;
963964 let stmt = Statement {
964965 conn : self ,
@@ -1104,7 +1105,7 @@ impl<'conn> Transaction<'conn> {
11041105 }
11051106
11061107 /// Like `Connection::execute`.
1107- pub fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < uint > {
1108+ pub fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < usize > {
11081109 self . conn . execute ( query, params)
11091110 }
11101111
@@ -1196,7 +1197,7 @@ pub struct Statement<'conn> {
11961197 name : String ,
11971198 param_types : Vec < Type > ,
11981199 result_desc : Vec < ResultDescription > ,
1199- next_portal_id : Cell < uint > ,
1200+ next_portal_id : Cell < usize > ,
12001201 finished : bool ,
12011202}
12021203
@@ -1303,7 +1304,7 @@ impl<'conn> Statement<'conn> {
13031304 /// Err(err) => println!("Error executing query: {}", err)
13041305 /// }
13051306 /// ```
1306- pub fn execute ( & self , params : & [ & ToSql ] ) -> Result < uint > {
1307+ pub fn execute ( & self , params : & [ & ToSql ] ) -> Result < usize > {
13071308 check_desync ! ( self . conn) ;
13081309 try!( self . inner_execute ( "" , 0 , params) ) ;
13091310
@@ -1489,7 +1490,7 @@ impl<'stmt> Iterator for Rows<'stmt> {
14891490 }
14901491
14911492 #[ inline]
1492- fn size_hint ( & self ) -> ( uint , Option < uint > ) {
1493+ fn size_hint ( & self ) -> ( usize , Option < usize > ) {
14931494 let lower = self . data . len ( ) ;
14941495 let upper = if self . more_rows {
14951496 None
@@ -1508,7 +1509,7 @@ pub struct Row<'stmt> {
15081509
15091510impl < ' stmt > Row < ' stmt > {
15101511 /// Returns the number of values in the row
1511- pub fn len ( & self ) -> uint {
1512+ pub fn len ( & self ) -> usize {
15121513 self . data . len ( )
15131514 }
15141515
@@ -1553,7 +1554,7 @@ impl<'stmt> Row<'stmt> {
15531554 pub fn get < I , T > ( & self , idx : I ) -> T where I : RowIndex + fmt:: Show + Clone , T : FromSql {
15541555 match self . get_opt ( idx. clone ( ) ) {
15551556 Ok ( ok) => ok,
1556- Err ( err) => panic ! ( "error retrieving column {}: {}" , idx, err)
1557+ Err ( err) => panic ! ( "error retrieving column {:? }: {:? }" , idx, err)
15571558 }
15581559 }
15591560}
@@ -1562,12 +1563,12 @@ impl<'stmt> Row<'stmt> {
15621563pub trait RowIndex {
15631564 /// Returns the index of the appropriate column, or `None` if no such
15641565 /// column exists.
1565- fn idx ( & self , stmt : & Statement ) -> Option < uint > ;
1566+ fn idx ( & self , stmt : & Statement ) -> Option < usize > ;
15661567}
15671568
1568- impl RowIndex for uint {
1569+ impl RowIndex for usize {
15691570 #[ inline]
1570- fn idx ( & self , stmt : & Statement ) -> Option < uint > {
1571+ fn idx ( & self , stmt : & Statement ) -> Option < usize > {
15711572 if * self >= stmt. result_desc . len ( ) {
15721573 None
15731574 } else {
@@ -1578,7 +1579,7 @@ impl RowIndex for uint {
15781579
15791580impl < ' a > RowIndex for & ' a str {
15801581 #[ inline]
1581- fn idx ( & self , stmt : & Statement ) -> Option < uint > {
1582+ fn idx ( & self , stmt : & Statement ) -> Option < usize > {
15821583 stmt. result_descriptions ( ) . iter ( ) . position ( |d| d. name == * self )
15831584 }
15841585}
@@ -1603,7 +1604,7 @@ impl<'trans, 'stmt> Iterator for LazyRows<'trans, 'stmt> {
16031604 self . result . try_next ( )
16041605 }
16051606
1606- fn size_hint ( & self ) -> ( uint , Option < uint > ) {
1607+ fn size_hint ( & self ) -> ( usize , Option < usize > ) {
16071608 self . result . size_hint ( )
16081609 }
16091610}
@@ -1643,7 +1644,7 @@ impl<'a> CopyInStatement<'a> {
16431644 /// providing a single result row.
16441645 ///
16451646 /// Returns the number of rows copied.
1646- pub fn execute < ' b , I , J > ( & self , mut rows : I ) -> Result < uint >
1647+ pub fn execute < ' b , I , J > ( & self , mut rows : I ) -> Result < usize >
16471648 where I : Iterator < Item =J > , J : Iterator < Item =& ' b ( ToSql + ' b ) > {
16481649 let mut conn = self . conn . conn . borrow_mut ( ) ;
16491650
@@ -1705,7 +1706,7 @@ impl<'a> CopyInStatement<'a> {
17051706 // FIXME this is not the right way to handle this
17061707 try_desync ! ( conn, conn. stream. write_message(
17071708 & CopyFail {
1708- message: & * err . to_string ( ) ,
1709+ message: & * format! ( "{:?}" , err ) ,
17091710 } ) ) ;
17101711 break ' l;
17111712 }
@@ -1770,7 +1771,7 @@ pub trait GenericConnection {
17701771 fn prepare < ' a > ( & ' a self , query : & str ) -> Result < Statement < ' a > > ;
17711772
17721773 /// Like `Connection::execute`.
1773- fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < uint > ;
1774+ fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < usize > ;
17741775
17751776 /// Like `Connection::prepare_copy_in`.
17761777 fn prepare_copy_in < ' a > ( & ' a self , table : & str , columns : & [ & str ] )
@@ -1788,7 +1789,7 @@ impl GenericConnection for Connection {
17881789 self . prepare ( query)
17891790 }
17901791
1791- fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < uint > {
1792+ fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < usize > {
17921793 self . execute ( query, params)
17931794 }
17941795
@@ -1811,7 +1812,7 @@ impl<'a> GenericConnection for Transaction<'a> {
18111812 self . prepare ( query)
18121813 }
18131814
1814- fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < uint > {
1815+ fn execute ( & self , query : & str , params : & [ & ToSql ] ) -> Result < usize > {
18151816 self . execute ( query, params)
18161817 }
18171818
0 commit comments