@@ -9,39 +9,32 @@ extern crate futures;
99
1010use futures:: { Future , IntoFuture , BoxFuture , Stream , Sink , Poll , StartSend } ;
1111use futures:: future:: Either ;
12- use postgres_shared:: params:: { ConnectParams , IntoConnectParams } ;
1312use postgres_protocol:: authentication;
1413use postgres_protocol:: message:: { backend, frontend} ;
1514use std:: collections:: HashMap ;
16- use std:: error:: Error ;
1715use std:: io;
1816use tokio_core:: reactor:: Handle ;
1917
18+ #[ doc( inline) ]
19+ pub use postgres_shared:: error;
20+ #[ doc( inline) ]
21+ pub use postgres_shared:: params;
22+
23+ use error:: ConnectError ;
24+ use params:: { ConnectParams , IntoConnectParams } ;
2025use stream:: PostgresStream ;
2126
2227mod stream;
2328
2429#[ cfg( test) ]
2530mod test;
2631
27- #[ derive( Debug ) ]
28- pub enum ConnectError {
29- Params ( Box < Error + Sync + Send > ) ,
30- Io ( io:: Error ) ,
31- }
32-
3332#[ derive( Debug , Copy , Clone ) ]
3433pub struct CancelData {
3534 pub process_id : i32 ,
3635 pub secret_key : i32 ,
3736}
3837
39- impl From < io:: Error > for ConnectError {
40- fn from ( e : io:: Error ) -> ConnectError {
41- ConnectError :: Io ( e)
42- }
43- }
44-
4538struct InnerConnectionState {
4639 parameters : HashMap < String , String > ,
4740 cancel_data : CancelData ,
@@ -116,7 +109,7 @@ impl Connection {
116109 {
117110 let params = match params. into_connect_params ( ) {
118111 Ok ( params) => params,
119- Err ( e) => return futures:: failed ( ConnectError :: Params ( e) ) . boxed ( ) ,
112+ Err ( e) => return futures:: failed ( ConnectError :: ConnectParams ( e) ) . boxed ( ) ,
120113 } ;
121114
122115 stream:: connect ( params. host ( ) , params. port ( ) , handle)
@@ -175,7 +168,7 @@ impl Connection {
175168 . map_err ( Into :: into)
176169 }
177170 None => {
178- Err ( ConnectError :: Params (
171+ Err ( ConnectError :: ConnectParams (
179172 "password was required but not provided" . into ( ) ) )
180173 }
181174 }
@@ -192,7 +185,7 @@ impl Connection {
192185 . map_err ( Into :: into)
193186 }
194187 None => {
195- Err ( ConnectError :: Params (
188+ Err ( ConnectError :: ConnectParams (
196189 "password was required but not provided" . into ( ) ) )
197190 }
198191 }
0 commit comments