From 310d2056f4620d301a99d10f91a373b3833eaab0 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Tue, 5 Dec 2017 19:32:14 -0800 Subject: [PATCH] Add derives for more enums --- src/sys/epoll.rs | 2 +- src/sys/socket/mod.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index 43a543ab12..c6c2eab33c 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -28,7 +28,7 @@ libc_bitflags!( } ); -#[derive(Clone, Copy, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[repr(i32)] pub enum EpollOp { EpollCtlAdd = libc::EPOLL_CTL_ADD, diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 28dac78d8c..e456ee5378 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -77,6 +77,7 @@ pub enum SockType { /// Constants used in [`socket`](fn.socket.html) and [`socketpair`](fn.socketpair.html) /// to specify the protocol to use. #[repr(i32)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum SockProtocol { /// TCP protocol ([ip(7)](http://man7.org/linux/man-pages/man7/ip.7.html)) Tcp = libc::IPPROTO_TCP, @@ -857,13 +858,14 @@ pub fn send(fd: RawFd, buf: &[u8], flags: MsgFlags) -> Result { /// /// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html) #[repr(i32)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum SockLevel { Socket = libc::SOL_SOCKET, Tcp = libc::IPPROTO_TCP, Ip = libc::IPPROTO_IP, Ipv6 = libc::IPPROTO_IPV6, Udp = libc::IPPROTO_UDP, - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "android", target_os = "linux"))] Netlink = libc::SOL_NETLINK, } @@ -970,7 +972,7 @@ pub unsafe fn sockaddr_storage_to_addr( } -#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum Shutdown { /// Further receptions will be disallowed. Read,