summaryrefslogtreecommitdiff
path: root/src/pty.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-06-12 03:17:57 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-06-12 03:17:57 +0000
commit50f55e77df63ed7ab9b8aad348653d44dce80ab2 (patch)
tree87cee38dfd2eb8c7995a1afd3dc3f479b74412ed /src/pty.rs
parent83407c536e6614c995e0271a984d568799076ab7 (diff)
parent37929c7dafd86571730e4f566ef520cf0139e008 (diff)
downloadnix-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/pty.rs')
-rw-r--r--src/pty.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/pty.rs b/src/pty.rs
index 41bd51b6..db012d81 100644
--- a/src/pty.rs
+++ b/src/pty.rs
@@ -18,8 +18,7 @@ use errno::Errno;
///
/// This is returned by `openpty`. Note that this type does *not* implement `Drop`, so the user
/// must manually close the file descriptors.
-#[derive(Clone, Copy)]
-#[allow(missing_debug_implementations)]
+#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct OpenptyResult {
/// The master port in a virtual pty pair
pub master: RawFd,
@@ -45,7 +44,7 @@ pub struct ForkptyResult {
/// While this datatype is a thin wrapper around `RawFd`, it enforces that the available PTY
/// functions are given the correct file descriptor. Additionally this type implements `Drop`,
/// so that when it's consumed or goes out of scope, it's automatically cleaned-up.
-#[derive(Debug)]
+#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct PtyMaster(RawFd);
impl AsRawFd for PtyMaster {