@@ -332,8 +332,8 @@ pub struct PostgresCancelData {
332332/// # let _ =
333333/// postgres::cancel_query(url, &NoSsl, cancel_data);
334334/// ```
335- pub fn cancel_query < T : IntoConnectParams > ( params : T , ssl : & SslMode , data : PostgresCancelData )
336- -> Result < ( ) , PostgresConnectError > {
335+ pub fn cancel_query < T > ( params : T , ssl : & SslMode , data : PostgresCancelData )
336+ -> Result < ( ) , PostgresConnectError > where T : IntoConnectParams {
337337 let params = try!( params. into_connect_params ( ) ) ;
338338
339339 let mut socket = match io:: initialize_stream ( & params, ssl) {
@@ -373,8 +373,9 @@ impl Drop for InnerPostgresConnection {
373373}
374374
375375impl InnerPostgresConnection {
376- fn connect < T : IntoConnectParams > ( params : T , ssl : & SslMode )
377- -> Result < InnerPostgresConnection , PostgresConnectError > {
376+ fn connect < T > ( params : T , ssl : & SslMode )
377+ -> Result < InnerPostgresConnection , PostgresConnectError >
378+ where T : IntoConnectParams {
378379 let params = try!( params. into_connect_params ( ) ) ;
379380 let stream = try!( io:: initialize_stream ( & params, ssl) ) ;
380381
@@ -716,8 +717,8 @@ impl PostgresConnection {
716717 /// };
717718 /// let maybe_conn = PostgresConnection::connect(params, &NoSsl);
718719 /// ```
719- pub fn connect < T : IntoConnectParams > ( params : T , ssl : & SslMode )
720- -> Result < PostgresConnection , PostgresConnectError > {
720+ pub fn connect < T > ( params : T , ssl : & SslMode ) -> Result < PostgresConnection , PostgresConnectError >
721+ where T : IntoConnectParams {
721722 InnerPostgresConnection :: connect ( params, ssl) . map ( |conn| {
722723 PostgresConnection { conn : RefCell :: new ( conn) }
723724 } )
@@ -998,7 +999,7 @@ impl<'conn> PostgresTransaction<'conn> {
998999 stmt : & ' stmt PostgresStatement ,
9991000 params : & [ & ToSql ] ,
10001001 row_limit : i32 )
1001- -> PostgresResult < PostgresLazyRows < ' trans , ' stmt > > {
1002+ -> PostgresResult < PostgresLazyRows < ' trans , ' stmt > > {
10021003 if self . conn as * const _ != stmt. conn as * const _ {
10031004 return Err ( PgWrongConnection ) ;
10041005 }
@@ -1385,13 +1386,12 @@ impl<'stmt> PostgresRow<'stmt> {
13851386 ///
13861387 /// Returns an `Error` value if the index does not reference a column or
13871388 /// the return type is not compatible with the Postgres type.
1388- pub fn get_opt < I : RowIndex , T : FromSql > ( & self , idx : I ) -> PostgresResult < T > {
1389+ pub fn get_opt < I , T > ( & self , idx : I ) -> PostgresResult < T > where I : RowIndex , T : FromSql {
13891390 let idx = match idx. idx ( self . stmt ) {
13901391 Some ( idx) => idx,
13911392 None => return Err ( PgInvalidColumn )
13921393 } ;
1393- FromSql :: from_sql ( & self . stmt . result_desc [ idx] . ty ,
1394- & self . data [ idx] )
1394+ FromSql :: from_sql ( & self . stmt . result_desc [ idx] . ty , & self . data [ idx] )
13951395 }
13961396
13971397 /// Retrieves the contents of a field of the row.
@@ -1415,7 +1415,7 @@ impl<'stmt> PostgresRow<'stmt> {
14151415 /// let foo: i32 = row.get(0u);
14161416 /// let bar: String = row.get("bar");
14171417 /// ```
1418- pub fn get < I : RowIndex +fmt :: Show + Clone , T : FromSql > ( & self , idx : I ) -> T {
1418+ pub fn get < I , T > ( & self , idx : I ) -> T where I : RowIndex + fmt :: Show + Clone , T : FromSql {
14191419 match self . get_opt ( idx. clone ( ) ) {
14201420 Ok ( ok) => ok,
14211421 Err ( err) => fail ! ( "error retrieving column {}: {}" , idx, err)
@@ -1451,8 +1451,7 @@ impl RowIndex for uint {
14511451impl < ' a > RowIndex for & ' a str {
14521452 #[ inline]
14531453 fn idx ( & self , stmt : & PostgresStatement ) -> Option < uint > {
1454- stmt. result_descriptions ( ) . iter ( )
1455- . position ( |d| d. name . as_slice ( ) == * self )
1454+ stmt. result_descriptions ( ) . iter ( ) . position ( |d| d. name . as_slice ( ) == * self )
14561455 }
14571456}
14581457
0 commit comments