@@ -35,14 +35,10 @@ pub struct CancelData {
35
35
pub secret_key : i32 ,
36
36
}
37
37
38
- struct InnerConnectionState {
39
- parameters : HashMap < String , String > ,
40
- cancel_data : CancelData ,
41
- }
42
-
43
38
struct InnerConnection {
44
39
stream : PostgresStream ,
45
- state : InnerConnectionState ,
40
+ parameters : HashMap < String , String > ,
41
+ cancel_data : CancelData ,
46
42
}
47
43
48
44
impl InnerConnection {
@@ -64,7 +60,7 @@ impl InnerConnection {
64
60
Ok ( value) => value. to_owned ( ) ,
65
61
Err ( e) => return Either :: A ( Err ( ( e, s) ) . into_future ( ) ) ,
66
62
} ;
67
- s. state . parameters . insert ( name, value) ;
63
+ s. parameters . insert ( name, value) ;
68
64
Either :: B ( s. read ( ) )
69
65
}
70
66
Some ( backend:: Message :: NoticeResponse ( _) ) => {
@@ -117,12 +113,10 @@ impl Connection {
117
113
. map ( |s| {
118
114
Connection ( InnerConnection {
119
115
stream : s,
120
- state : InnerConnectionState {
121
- parameters : HashMap :: new ( ) ,
122
- cancel_data : CancelData {
123
- process_id : 0 ,
124
- secret_key : 0 ,
125
- }
116
+ parameters : HashMap :: new ( ) ,
117
+ cancel_data : CancelData {
118
+ process_id : 0 ,
119
+ secret_key : 0 ,
126
120
}
127
121
} )
128
122
} )
@@ -230,8 +224,8 @@ impl Connection {
230
224
. and_then ( |( m, mut s) | {
231
225
match m {
232
226
backend:: Message :: BackendKeyData ( body) => {
233
- s. state . cancel_data . process_id = body. process_id ( ) ;
234
- s. state . cancel_data . secret_key = body. secret_key ( ) ;
227
+ s. cancel_data . process_id = body. process_id ( ) ;
228
+ s. cancel_data . secret_key = body. secret_key ( ) ;
235
229
Either :: A ( Connection ( s) . finish_startup ( ) )
236
230
}
237
231
backend:: Message :: ReadyForQuery ( _) => Either :: B ( Ok ( Connection ( s) ) . into_future ( ) ) ,
@@ -245,7 +239,7 @@ impl Connection {
245
239
}
246
240
247
241
pub fn cancel_data ( & self ) -> CancelData {
248
- self . 0 . state . cancel_data
242
+ self . 0 . cancel_data
249
243
}
250
244
}
251
245
0 commit comments