Skip to content

Commit 5b1010d

Browse files
committed
Reexport enums variants
With rust-lang/rust#18973 merged enum variants are namespaced. They should be reexported or used like Enum::Variant.
1 parent beb14d0 commit 5b1010d

File tree

7 files changed

+34
-5
lines changed

7 files changed

+34
-5
lines changed

src/error.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
use std::io;
22
use nix::errno::{SysError, EAGAIN};
33

4+
use self::MioErrorKind::{
5+
Eof,
6+
BufUnderflow,
7+
BufOverflow,
8+
WouldBlock,
9+
EventLoopTerminated,
10+
OtherError
11+
};
12+
413
pub type MioResult<T> = Result<T, MioError>;
514

615
#[deriving(Show, PartialEq, Clone)]

src/io.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use buf::{Buf, MutBuf};
22
use os;
33
use error::MioResult;
44

5+
use self::NonBlock::{Ready, WouldBlock};
6+
57
#[deriving(Show)]
68
pub enum NonBlock<T> {
79
Ready(T),

src/net.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ pub use std::io::net::ip::{IpAddr, Port};
1010
pub use std::io::net::ip::Ipv4Addr as IPv4Addr;
1111
pub use std::io::net::ip::Ipv6Addr as IPv6Addr;
1212

13+
use self::SockAddr::{InetAddr,UnixAddr};
14+
use self::AddressFamily::{Unix,Inet,Inet6};
15+
1316
pub trait Socket : IoHandle {
1417
fn linger(&self) -> MioResult<uint> {
1518
os::linger(self.desc())
@@ -129,8 +132,11 @@ pub mod tcp {
129132
use error::MioResult;
130133
use buf::{Buf, MutBuf};
131134
use io;
132-
use io::{IoHandle, IoAcceptor, IoReader, IoWriter, NonBlock, Ready, WouldBlock};
133-
use net::{AddressFamily, Socket, SockAddr, Inet, Inet6, Stream};
135+
use io::{IoHandle, IoAcceptor, IoReader, IoWriter, NonBlock};
136+
use io::NonBlock::{Ready, WouldBlock};
137+
use net::{AddressFamily, Socket, SockAddr};
138+
use net::SocketType::Stream;
139+
use net::AddressFamily::{Inet, Inet6};
134140

135141
#[deriving(Show)]
136142
pub struct TcpSocket {
@@ -237,8 +243,11 @@ pub mod udp {
237243
use os;
238244
use error::MioResult;
239245
use buf::{Buf, MutBuf};
240-
use io::{IoHandle, IoReader, IoWriter, NonBlock, Ready, WouldBlock};
241-
use net::{AddressFamily, Socket, MulticastSocket, SockAddr, Inet, Dgram};
246+
use io::{IoHandle, IoReader, IoWriter, NonBlock};
247+
use io::NonBlock::{Ready, WouldBlock};
248+
use net::{AddressFamily, Socket, MulticastSocket, SockAddr};
249+
use net::SocketType::Dgram;
250+
use net::AddressFamily::Inet;
242251
use super::UnconnectedSocket;
243252

244253
#[deriving(Show)]

src/os/posix.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use std::mem;
22
use error::{MioResult, MioError};
3-
use net::{AddressFamily, Inet, Inet6, SockAddr, InetAddr, IPv4Addr, SocketType, Dgram, Stream};
3+
use net::{AddressFamily, SockAddr, IPv4Addr, SocketType};
4+
use net::SocketType::{Dgram, Stream};
5+
use net::SockAddr::InetAddr;
6+
use net::AddressFamily::{Inet, Inet6};
47
pub use std::io::net::ip::IpAddr;
58

69
mod nix {

src/timer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use time::precise_time_ns;
66
use token::Token;
77
use util::Slab;
88

9+
use self::TimerErrorKind::TimerOverflow;
10+
911
const EMPTY: Token = Token(uint::MAX);
1012
const NS_PER_MS: u64 = 1_000_000;
1113

test/test_close_on_drop.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use mio::net::*;
44
use mio::net::tcp::*;
55
use super::localhost;
66

7+
use self::TestState::{Initial, AfterRead, AfterHup};
8+
79
type TestEventLoop = EventLoop<uint, ()>;
810

911
#[deriving(Show, PartialEq)]

test/test_timer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use mio::net::*;
44
use mio::net::tcp::*;
55
use super::localhost;
66

7+
use self::TestState::{Initial, AfterHup, AfterRead};
8+
79
type TestEventLoop = EventLoop<TcpSocket, ()>;
810

911
const SERVER: Token = Token(0);

0 commit comments

Comments
 (0)