@@ -10,25 +10,24 @@ use std::fmt;
1010use std:: mem;
1111use std:: rc:: Rc ;
1212use postgres:: { IntoConnectParams , SslMode } ;
13- use postgres:: error:: { PostgresConnectError , PostgresError } ;
1413use postgres:: types:: ToSql ;
1514
1615pub enum Error {
17- ConnectError ( PostgresConnectError ) ,
18- OtherError ( PostgresError ) ,
16+ Connect ( postgres :: ConnectError ) ,
17+ Other ( postgres :: Error ) ,
1918}
2019
2120impl fmt:: Show for Error {
2221 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
2322 match * self {
24- ConnectError ( ref e) => write ! ( fmt, "{}" , e) ,
25- OtherError ( ref e) => write ! ( fmt, "{}" , e) ,
23+ Error :: Connect ( ref e) => write ! ( fmt, "{}" , e) ,
24+ Error :: Other ( ref e) => write ! ( fmt, "{}" , e) ,
2625 }
2726 }
2827}
2928
3029pub struct PostgresPoolManager {
31- params : Result < postgres:: ConnectParams , PostgresConnectError > ,
30+ params : Result < postgres:: ConnectParams , postgres :: ConnectError > ,
3231 ssl_mode : SslMode ,
3332}
3433
@@ -45,14 +44,14 @@ impl r2d2::PoolManager<postgres::Connection, Error> for PostgresPoolManager {
4544 fn connect ( & self ) -> Result < postgres:: Connection , Error > {
4645 match self . params {
4746 Ok ( ref p) => {
48- postgres:: Connection :: connect ( p. clone ( ) , & self . ssl_mode ) . map_err ( ConnectError )
47+ postgres:: Connection :: connect ( p. clone ( ) , & self . ssl_mode ) . map_err ( Error :: Connect )
4948 }
50- Err ( ref e) => Err ( ConnectError ( e. clone ( ) ) )
49+ Err ( ref e) => Err ( Error :: Connect ( e. clone ( ) ) )
5150 }
5251 }
5352
5453 fn is_valid ( & self , conn : & mut postgres:: Connection ) -> Result < ( ) , Error > {
55- conn. batch_execute ( "" ) . map_err ( OtherError )
54+ conn. batch_execute ( "" ) . map_err ( Error :: Other )
5655 }
5756
5857 fn has_broken ( & self , conn : & mut postgres:: Connection ) -> bool {
0 commit comments