@@ -28,6 +28,7 @@ use postgres_shared::rows::RowIndex;
2828use std:: error:: Error as StdError ;
2929use std:: fmt;
3030use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
31+ use tokio_io:: { AsyncRead , AsyncWrite } ;
3132
3233#[ doc( inline) ]
3334pub use postgres_shared:: stmt:: Column ;
@@ -38,7 +39,7 @@ pub use postgres_shared::{CancelData, Notification};
3839
3940use error:: { DbError , Error } ;
4041use params:: ConnectParams ;
41- use tls:: TlsConnect ;
42+ use tls:: { TlsConnect , TlsStream } ;
4243use types:: { FromSql , ToSql , Type } ;
4344
4445pub mod error;
@@ -125,9 +126,12 @@ impl Client {
125126}
126127
127128#[ must_use = "futures do nothing unless polled" ]
128- pub struct Connection ( proto:: Connection ) ;
129+ pub struct Connection < S > ( proto:: Connection < S > ) ;
129130
130- impl Connection {
131+ impl < S > Connection < S >
132+ where
133+ S : AsyncRead + AsyncWrite ,
134+ {
131135 pub fn cancel_data ( & self ) -> CancelData {
132136 self . 0 . cancel_data ( )
133137 }
@@ -141,7 +145,10 @@ impl Connection {
141145 }
142146}
143147
144- impl Future for Connection {
148+ impl < S > Future for Connection < S >
149+ where
150+ S : AsyncRead + AsyncWrite ,
151+ {
145152 type Item = ( ) ;
146153 type Error = Error ;
147154
@@ -173,10 +180,10 @@ impl Future for CancelQuery {
173180pub struct Handshake ( proto:: HandshakeFuture ) ;
174181
175182impl Future for Handshake {
176- type Item = ( Client , Connection ) ;
183+ type Item = ( Client , Connection < Box < TlsStream > > ) ;
177184 type Error = Error ;
178185
179- fn poll ( & mut self ) -> Poll < ( Client , Connection ) , Error > {
186+ fn poll ( & mut self ) -> Poll < ( Client , Connection < Box < TlsStream > > ) , Error > {
180187 let ( client, connection) = try_ready ! ( self . 0 . poll( ) ) ;
181188
182189 Ok ( Async :: Ready ( ( Client ( client) , Connection ( connection) ) ) )
0 commit comments