@@ -7,14 +7,14 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
7
7
use types:: Oid ;
8
8
use priv_io:: StreamOptions ;
9
9
10
- use self :: BackendMessage :: * ;
11
- use self :: FrontendMessage :: * ;
10
+ use self :: Backend :: * ;
11
+ use self :: Frontend :: * ;
12
12
13
13
pub const PROTOCOL_VERSION : u32 = 0x0003_0000 ;
14
14
pub const CANCEL_CODE : u32 = 80877102 ;
15
15
pub const SSL_CODE : u32 = 80877103 ;
16
16
17
- pub enum BackendMessage {
17
+ pub enum Backend {
18
18
AuthenticationCleartextPassword ,
19
19
AuthenticationGSS ,
20
20
AuthenticationKerberosV5 ,
@@ -89,7 +89,7 @@ pub struct RowDescriptionEntry {
89
89
pub format : i16 ,
90
90
}
91
91
92
- pub enum FrontendMessage < ' a > {
92
+ pub enum Frontend < ' a > {
93
93
Bind {
94
94
portal : & ' a str ,
95
95
statement : & ' a str ,
@@ -157,12 +157,12 @@ impl<W: Write> WriteCStr for W {
157
157
158
158
#[ doc( hidden) ]
159
159
pub trait WriteMessage {
160
- fn write_message ( & mut self , & FrontendMessage ) -> io:: Result < ( ) > ;
160
+ fn write_message ( & mut self , & Frontend ) -> io:: Result < ( ) > ;
161
161
}
162
162
163
163
impl < W : Write > WriteMessage for W {
164
164
#[ allow( cyclomatic_complexity) ]
165
- fn write_message ( & mut self , message : & FrontendMessage ) -> io:: Result < ( ) > {
165
+ fn write_message ( & mut self , message : & Frontend ) -> io:: Result < ( ) > {
166
166
let mut buf = vec ! [ ] ;
167
167
let mut ident = None ;
168
168
@@ -283,22 +283,22 @@ impl<R: BufRead> ReadCStr for R {
283
283
284
284
#[ doc( hidden) ]
285
285
pub trait ReadMessage {
286
- fn read_message ( & mut self ) -> io:: Result < BackendMessage > ;
286
+ fn read_message ( & mut self ) -> io:: Result < Backend > ;
287
287
288
- fn read_message_timeout ( & mut self , timeout : Duration ) -> io:: Result < Option < BackendMessage > > ;
288
+ fn read_message_timeout ( & mut self , timeout : Duration ) -> io:: Result < Option < Backend > > ;
289
289
290
- fn read_message_nonblocking ( & mut self ) -> io:: Result < Option < BackendMessage > > ;
290
+ fn read_message_nonblocking ( & mut self ) -> io:: Result < Option < Backend > > ;
291
291
292
- fn finish_read_message ( & mut self , ident : u8 ) -> io:: Result < BackendMessage > ;
292
+ fn finish_read_message ( & mut self , ident : u8 ) -> io:: Result < Backend > ;
293
293
}
294
294
295
295
impl < R : BufRead + StreamOptions > ReadMessage for R {
296
- fn read_message ( & mut self ) -> io:: Result < BackendMessage > {
296
+ fn read_message ( & mut self ) -> io:: Result < Backend > {
297
297
let ident = try!( self . read_u8 ( ) ) ;
298
298
self . finish_read_message ( ident)
299
299
}
300
300
301
- fn read_message_timeout ( & mut self , timeout : Duration ) -> io:: Result < Option < BackendMessage > > {
301
+ fn read_message_timeout ( & mut self , timeout : Duration ) -> io:: Result < Option < Backend > > {
302
302
try!( self . set_read_timeout ( Some ( timeout) ) ) ;
303
303
let ident = self . read_u8 ( ) ;
304
304
try!( self . set_read_timeout ( None ) ) ;
@@ -316,7 +316,7 @@ impl<R: BufRead + StreamOptions> ReadMessage for R {
316
316
}
317
317
}
318
318
319
- fn read_message_nonblocking ( & mut self ) -> io:: Result < Option < BackendMessage > > {
319
+ fn read_message_nonblocking ( & mut self ) -> io:: Result < Option < Backend > > {
320
320
try!( self . set_nonblocking ( true ) ) ;
321
321
let ident = self . read_u8 ( ) ;
322
322
try!( self . set_nonblocking ( false ) ) ;
@@ -335,7 +335,7 @@ impl<R: BufRead + StreamOptions> ReadMessage for R {
335
335
}
336
336
337
337
#[ allow( cyclomatic_complexity) ]
338
- fn finish_read_message ( & mut self , ident : u8 ) -> io:: Result < BackendMessage > {
338
+ fn finish_read_message ( & mut self , ident : u8 ) -> io:: Result < Backend > {
339
339
// subtract size of length value
340
340
let len = try!( self . read_u32 :: < BigEndian > ( ) ) - mem:: size_of :: < u32 > ( ) as u32 ;
341
341
let mut rdr = self . by_ref ( ) . take ( len as u64 ) ;
@@ -428,7 +428,7 @@ fn read_fields<R: BufRead>(buf: &mut R) -> io::Result<Vec<(u8, String)>> {
428
428
Ok ( fields)
429
429
}
430
430
431
- fn read_data_row < R : BufRead > ( buf : & mut R ) -> io:: Result < BackendMessage > {
431
+ fn read_data_row < R : BufRead > ( buf : & mut R ) -> io:: Result < Backend > {
432
432
let len = try!( buf. read_u16 :: < BigEndian > ( ) ) as usize ;
433
433
let mut values = Vec :: with_capacity ( len) ;
434
434
@@ -447,7 +447,7 @@ fn read_data_row<R: BufRead>(buf: &mut R) -> io::Result<BackendMessage> {
447
447
Ok ( DataRow { row : values } )
448
448
}
449
449
450
- fn read_auth_message < R : Read > ( buf : & mut R ) -> io:: Result < BackendMessage > {
450
+ fn read_auth_message < R : Read > ( buf : & mut R ) -> io:: Result < Backend > {
451
451
Ok ( match try!( buf. read_i32 :: < BigEndian > ( ) ) {
452
452
0 => AuthenticationOk ,
453
453
2 => AuthenticationKerberosV5 ,
@@ -467,7 +467,7 @@ fn read_auth_message<R: Read>(buf: &mut R) -> io::Result<BackendMessage> {
467
467
} )
468
468
}
469
469
470
- fn read_parameter_description < R : Read > ( buf : & mut R ) -> io:: Result < BackendMessage > {
470
+ fn read_parameter_description < R : Read > ( buf : & mut R ) -> io:: Result < Backend > {
471
471
let len = try!( buf. read_u16 :: < BigEndian > ( ) ) as usize ;
472
472
let mut types = Vec :: with_capacity ( len) ;
473
473
@@ -478,7 +478,7 @@ fn read_parameter_description<R: Read>(buf: &mut R) -> io::Result<BackendMessage
478
478
Ok ( ParameterDescription { types : types } )
479
479
}
480
480
481
- fn read_row_description < R : BufRead > ( buf : & mut R ) -> io:: Result < BackendMessage > {
481
+ fn read_row_description < R : BufRead > ( buf : & mut R ) -> io:: Result < Backend > {
482
482
let len = try!( buf. read_u16 :: < BigEndian > ( ) ) as usize ;
483
483
let mut types = Vec :: with_capacity ( len) ;
484
484
0 commit comments