diff options
author | Bryant Mairs <bryantmairs@google.com> | 2017-12-05 19:10:44 -0800 |
---|---|---|
committer | Bryant Mairs <bryantmairs@google.com> | 2017-12-10 20:47:48 -0800 |
commit | de9d72dd2e4ec534343c2c1a94bb9867296e1a0c (patch) | |
tree | 960ef1d7cdb2a371f3241f3e4df84e9f5d08334e | |
parent | 75e798f1790a47c8792b746b1602d4abcc3ca81f (diff) | |
download | nix-de9d72dd2e4ec534343c2c1a94bb9867296e1a0c.zip |
Add more derives for SignalFd and various enums
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/sys/epoll.rs | 2 | ||||
-rw-r--r-- | src/sys/signalfd.rs | 2 | ||||
-rw-r--r-- | src/sys/socket/mod.rs | 6 |
4 files changed, 8 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ed34ef41..4cee749a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added the `from_raw()` method to `WaitStatus` for converting raw status values to `WaitStatus` independent of syscalls. ([#741](https://github.com/nix-rust/nix/pull/741)) +- Added more standard trait implementations for various types. + ([#814](https://github.com/nix-rust/nix/pull/814)) ### Changed - Use native `pipe2` on all BSD targets. Users should notice no difference. diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index 43a543ab..c6c2eab3 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/signalfd.rs b/src/sys/signalfd.rs index 7ea09ee3..0da9187e 100644 --- a/src/sys/signalfd.rs +++ b/src/sys/signalfd.rs @@ -79,7 +79,7 @@ pub fn signalfd(fd: RawFd, mask: &SigSet, flags: SfdFlags) -> Result<RawFd> { /// Err(err) => (), // some error happend /// } /// ``` -#[derive(Debug)] +#[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct SignalFd(RawFd); impl SignalFd { diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index bd8764b7..2102c1ce 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, @@ -825,13 +826,14 @@ pub struct ucred { /// /// [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, } @@ -938,7 +940,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, |