Skip to content

Commit a6f0edb

Browse files
committed
Merge pull request #79 from kyledewey/enum_namespace_fix
Added imports for members of enums
2 parents 4811d0d + 57ce8f7 commit a6f0edb

File tree

7 files changed

+53
-36
lines changed

7 files changed

+53
-36
lines changed

src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ use phf;
1212
use Result;
1313
use types::Type;
1414

15+
use self::ConnectError::*;
16+
use self::Error::*;
17+
1518
macro_rules! make_errors(
1619
($($code:expr => $error:ident),+) => (
1720
/// SQLSTATE error codes

src/io.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ use std::io::{Stream, IoResult};
66

77
use {ConnectParams, SslMode, ConnectTarget, ConnectError};
88
use message;
9-
use message::{SslRequest, WriteMessage};
9+
use message::WriteMessage;
10+
use message::FrontendMessage::SslRequest;
11+
12+
use self::InternalStream::{TcpStream, UnixStream};
1013

1114
const DEFAULT_PORT: Port = 5432;
1215

src/message.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ use std::mem;
33

44
use types::Oid;
55

6+
use self::BackendMessage::*;
7+
use self::FrontendMessage::*;
8+
69
pub const PROTOCOL_VERSION: u32 = 0x0003_0000;
710
pub const CANCEL_CODE: u32 = 80877102;
811
pub const SSL_CODE: u32 = 80877103;

src/types/array.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
use std::mem;
44
use std::slice;
55

6+
use self::ArrayParent::{SliceParent, MutSliceParent, BaseParent};
7+
use self::MutArrayParent::{MutSliceMutParent, MutBaseParent};
8+
69
/// Information about a dimension of an array
710
#[deriving(PartialEq, Eq, Clone)]
811
pub struct DimensionInfo {

src/types/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use std::io::{ByRefReader, MemWriter, BufReader};
55

66
use self::Type::*;
77
use Result;
8-
use error::{PgWrongType, PgWasNull, PgBadData};
9-
use types::range::{Inclusive, Exclusive, Range};
8+
use error::Error::{PgWrongType, PgWasNull, PgBadData};
9+
use types::range::Range;
10+
use types::range::BoundType::{Inclusive, Exclusive};
1011

1112
macro_rules! check_types(
1213
($($expected:pat)|+, $actual:ident) => (

src/types/range.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ use std::fmt;
33
use std::i32;
44
use std::i64;
55

6+
use self::BoundSide::{Lower, Upper};
7+
use self::BoundType::{Inclusive, Exclusive};
8+
use self::InnerRange::{Empty, Normal};
9+
610
/// The `range!` macro can make it easier to create ranges. It roughly mirrors
711
/// traditional mathematic range syntax.
812
///

src/url.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ fn get_authority(rawurl: &str) ->
278278
}
279279

280280
let len = rawurl.len();
281-
let mut st = Start;
282-
let mut input = Digit; // most restricted, start here.
281+
let mut st = State::Start;
282+
let mut input = Input::Digit; // most restricted, start here.
283283

284284
let mut userinfo = None;
285285
let mut host = "";
@@ -298,15 +298,15 @@ fn get_authority(rawurl: &str) ->
298298
'0' ... '9' => (),
299299
'A' ... 'F'
300300
| 'a' ... 'f' => {
301-
if input == Digit {
302-
input = Hex;
301+
if input == Input::Digit {
302+
input = Input::Hex;
303303
}
304304
}
305305
'G' ... 'Z'
306306
| 'g' ... 'z'
307307
| '-' | '.' | '_' | '~' | '%'
308308
| '&' |'\'' | '(' | ')' | '+'
309-
| '!' | '*' | ',' | ';' | '=' => input = Unreserved,
309+
| '!' | '*' | ',' | ';' | '=' => input = Input::Unreserved,
310310
':' | '@' | '?' | '#' | '/' => {
311311
// separators, don't change anything
312312
}
@@ -318,61 +318,61 @@ fn get_authority(rawurl: &str) ->
318318
':' => {
319319
colon_count += 1;
320320
match st {
321-
Start => {
321+
State::Start => {
322322
pos = i;
323-
st = PassHostPort;
323+
st = State::PassHostPort;
324324
}
325-
PassHostPort => {
325+
State::PassHostPort => {
326326
// multiple colons means ipv6 address.
327-
if input == Unreserved {
327+
if input == Input::Unreserved {
328328
return Err(
329329
"Illegal characters in IPv6 address.".to_string());
330330
}
331-
st = Ip6Host;
331+
st = State::Ip6Host;
332332
}
333-
InHost => {
333+
State::InHost => {
334334
pos = i;
335-
if input == Unreserved {
335+
if input == Input::Unreserved {
336336
// must be port
337337
host = rawurl.slice(begin, i);
338-
st = InPort;
338+
st = State::InPort;
339339
} else {
340340
// can't be sure whether this is an ipv6 address or a port
341-
st = Ip6Port;
341+
st = State::Ip6Port;
342342
}
343343
}
344-
Ip6Port => {
345-
if input == Unreserved {
344+
State::Ip6Port => {
345+
if input == Input::Unreserved {
346346
return Err("Illegal characters in authority.".to_string());
347347
}
348-
st = Ip6Host;
348+
st = State::Ip6Host;
349349
}
350-
Ip6Host => {
350+
State::Ip6Host => {
351351
if colon_count > 7 {
352352
host = rawurl.slice(begin, i);
353353
pos = i;
354-
st = InPort;
354+
st = State::InPort;
355355
}
356356
}
357357
_ => return Err("Invalid ':' in authority.".to_string()),
358358
}
359-
input = Digit; // reset input class
359+
input = Input::Digit; // reset input class
360360
}
361361

362362
'@' => {
363-
input = Digit; // reset input class
363+
input = Input::Digit; // reset input class
364364
colon_count = 0; // reset count
365365
match st {
366-
Start => {
366+
State::Start => {
367367
let user = rawurl.slice(begin, i).to_string();
368368
userinfo = Some(UserInfo::new(user, None));
369-
st = InHost;
369+
st = State::InHost;
370370
}
371-
PassHostPort => {
371+
State::PassHostPort => {
372372
let user = rawurl.slice(begin, pos).to_string();
373373
let pass = rawurl.slice(pos+1, i).to_string();
374374
userinfo = Some(UserInfo::new(user, Some(pass)));
375-
st = InHost;
375+
st = State::InHost;
376376
}
377377
_ => return Err("Invalid '@' in authority.".to_string()),
378378
}
@@ -389,19 +389,19 @@ fn get_authority(rawurl: &str) ->
389389

390390
// finish up
391391
match st {
392-
Start => host = rawurl.slice(begin, end),
393-
PassHostPort
394-
| Ip6Port => {
395-
if input != Digit {
392+
State::Start => host = rawurl.slice(begin, end),
393+
State::PassHostPort
394+
| State::Ip6Port => {
395+
if input != Input::Digit {
396396
return Err("Non-digit characters in port.".to_string());
397397
}
398398
host = rawurl.slice(begin, pos);
399399
port = Some(rawurl.slice(pos+1, end));
400400
}
401-
Ip6Host
402-
| InHost => host = rawurl.slice(begin, end),
403-
InPort => {
404-
if input != Digit {
401+
State::Ip6Host
402+
| State::InHost => host = rawurl.slice(begin, end),
403+
State::InPort => {
404+
if input != Input::Digit {
405405
return Err("Non-digit characters in port.".to_string());
406406
}
407407
port = Some(rawurl.slice(pos+1, end));

0 commit comments

Comments
 (0)