Skip to content

Commit

Permalink
Reexport enums variants
Browse files Browse the repository at this point in the history
With rust-lang/rust#18973 merged enum variants are namespaced. They should be reexported or used like Enum::Variant.
  • Loading branch information
rozaliev committed Nov 19, 2014
1 parent beb14d0 commit 5b1010d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
use std::io;
use nix::errno::{SysError, EAGAIN};

use self::MioErrorKind::{
Eof,
BufUnderflow,
BufOverflow,
WouldBlock,
EventLoopTerminated,
OtherError
};

pub type MioResult<T> = Result<T, MioError>;

#[deriving(Show, PartialEq, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use buf::{Buf, MutBuf};
use os;
use error::MioResult;

use self::NonBlock::{Ready, WouldBlock};

#[deriving(Show)]
pub enum NonBlock<T> {
Ready(T),
Expand Down
17 changes: 13 additions & 4 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub use std::io::net::ip::{IpAddr, Port};
pub use std::io::net::ip::Ipv4Addr as IPv4Addr;
pub use std::io::net::ip::Ipv6Addr as IPv6Addr;

use self::SockAddr::{InetAddr,UnixAddr};
use self::AddressFamily::{Unix,Inet,Inet6};

pub trait Socket : IoHandle {
fn linger(&self) -> MioResult<uint> {
os::linger(self.desc())
Expand Down Expand Up @@ -129,8 +132,11 @@ pub mod tcp {
use error::MioResult;
use buf::{Buf, MutBuf};
use io;
use io::{IoHandle, IoAcceptor, IoReader, IoWriter, NonBlock, Ready, WouldBlock};
use net::{AddressFamily, Socket, SockAddr, Inet, Inet6, Stream};
use io::{IoHandle, IoAcceptor, IoReader, IoWriter, NonBlock};
use io::NonBlock::{Ready, WouldBlock};
use net::{AddressFamily, Socket, SockAddr};
use net::SocketType::Stream;
use net::AddressFamily::{Inet, Inet6};

#[deriving(Show)]
pub struct TcpSocket {
Expand Down Expand Up @@ -237,8 +243,11 @@ pub mod udp {
use os;
use error::MioResult;
use buf::{Buf, MutBuf};
use io::{IoHandle, IoReader, IoWriter, NonBlock, Ready, WouldBlock};
use net::{AddressFamily, Socket, MulticastSocket, SockAddr, Inet, Dgram};
use io::{IoHandle, IoReader, IoWriter, NonBlock};
use io::NonBlock::{Ready, WouldBlock};
use net::{AddressFamily, Socket, MulticastSocket, SockAddr};
use net::SocketType::Dgram;
use net::AddressFamily::Inet;
use super::UnconnectedSocket;

#[deriving(Show)]
Expand Down
5 changes: 4 additions & 1 deletion src/os/posix.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use std::mem;
use error::{MioResult, MioError};
use net::{AddressFamily, Inet, Inet6, SockAddr, InetAddr, IPv4Addr, SocketType, Dgram, Stream};
use net::{AddressFamily, SockAddr, IPv4Addr, SocketType};
use net::SocketType::{Dgram, Stream};
use net::SockAddr::InetAddr;
use net::AddressFamily::{Inet, Inet6};
pub use std::io::net::ip::IpAddr;

mod nix {
Expand Down
2 changes: 2 additions & 0 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use time::precise_time_ns;
use token::Token;
use util::Slab;

use self::TimerErrorKind::TimerOverflow;

const EMPTY: Token = Token(uint::MAX);
const NS_PER_MS: u64 = 1_000_000;

Expand Down
2 changes: 2 additions & 0 deletions test/test_close_on_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use mio::net::*;
use mio::net::tcp::*;
use super::localhost;

use self::TestState::{Initial, AfterRead, AfterHup};

type TestEventLoop = EventLoop<uint, ()>;

#[deriving(Show, PartialEq)]
Expand Down
2 changes: 2 additions & 0 deletions test/test_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use mio::net::*;
use mio::net::tcp::*;
use super::localhost;

use self::TestState::{Initial, AfterHup, AfterRead};

type TestEventLoop = EventLoop<TcpSocket, ()>;

const SERVER: Token = Token(0);
Expand Down

0 comments on commit 5b1010d

Please sign in to comment.