diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-12 03:17:57 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-12 03:17:57 +0000 |
commit | 50f55e77df63ed7ab9b8aad348653d44dce80ab2 (patch) | |
tree | 87cee38dfd2eb8c7995a1afd3dc3f479b74412ed /src/mqueue.rs | |
parent | 83407c536e6614c995e0271a984d568799076ab7 (diff) | |
parent | 37929c7dafd86571730e4f566ef520cf0139e008 (diff) | |
download | nix-50f55e77df63ed7ab9b8aad348653d44dce80ab2.zip |
Merge #1035
1035: Implement extra traits for all types r=asomers a=Susurrus
Now that I've gotten all the extra traits implemented for `libc`, they can be easily derived for `nix`'s types. Note that this requires a bump to the minimum supported Rust version, but it's still at least 2 versions behind, so it fits in with policy.
One thing I did notice is that we have an inconsistent approach to our newtypes, where some use a struct and some a tuple struct. We should be consistent here, and should probably use a tuple struct since the name of the single field is irrelevant. This style is already suggested in our `CONVENTIONS.md` doc, so this should be uncontroversial. I'll file a PR after this is merged adding that.
Co-authored-by: Bryant Mairs <bryant@mai.rs>
Diffstat (limited to 'src/mqueue.rs')
-rw-r--r-- | src/mqueue.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/mqueue.rs b/src/mqueue.rs index 87be6532..b958b71c 100644 --- a/src/mqueue.rs +++ b/src/mqueue.rs @@ -29,22 +29,11 @@ libc_bitflags!{ } #[repr(C)] -#[derive(Clone, Copy)] -#[allow(missing_debug_implementations)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct MqAttr { mq_attr: libc::mq_attr, } -impl PartialEq<MqAttr> for MqAttr { - fn eq(&self, other: &MqAttr) -> bool { - let self_attr = self.mq_attr; - let other_attr = other.mq_attr; - self_attr.mq_flags == other_attr.mq_flags && self_attr.mq_maxmsg == other_attr.mq_maxmsg && - self_attr.mq_msgsize == other_attr.mq_msgsize && - self_attr.mq_curmsgs == other_attr.mq_curmsgs - } -} - impl MqAttr { pub fn new(mq_flags: c_long, mq_maxmsg: c_long, |