From dc7ad26ac18d0de5fb3601dfd1a28920c9b85f07 Mon Sep 17 00:00:00 2001 From: Sander Maijers Date: Thu, 19 Oct 2017 15:32:48 +0200 Subject: [PATCH] Make types eagerly implement common traits See https://rust-lang-nursery.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits --- src/client.rs | 2 ++ src/mailbox.rs | 2 +- src/mock_stream.rs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index 9eb8b28..1fcc384 100644 --- a/src/client.rs +++ b/src/client.rs @@ -16,6 +16,7 @@ const CR: u8 = 0x0d; const LF: u8 = 0x0a; /// Stream to interface with the IMAP server. This interface is only for the command stream. +#[derive(Debug)] pub struct Client { stream: BufStream, tag: u32, @@ -28,6 +29,7 @@ pub struct Client { /// 2177](https://tools.ietf.org/html/rfc2177). /// /// As long a the handle is active, the mailbox cannot be otherwise accessed. +#[derive(Debug)] pub struct IdleHandle<'a, T: Read + Write + 'a> { client: &'a mut Client, keepalive: Duration, diff --git a/src/mailbox.rs b/src/mailbox.rs index 6d5f878..9e2456a 100644 --- a/src/mailbox.rs +++ b/src/mailbox.rs @@ -1,6 +1,6 @@ use std::fmt; -#[derive(Eq, PartialEq)] +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, Hash)] pub struct Mailbox { pub flags: String, pub exists: u32, diff --git a/src/mock_stream.rs b/src/mock_stream.rs index c06652f..81325dd 100644 --- a/src/mock_stream.rs +++ b/src/mock_stream.rs @@ -1,6 +1,7 @@ use std::io::{Error, ErrorKind, Read, Result, Write}; use std::cmp::min; +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, Hash)] pub struct MockStream { read_buf: Vec, read_pos: usize,