From 176166b60a610bac455899aff39a06f2e802dade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 16 Oct 2019 01:23:21 +0200 Subject: [PATCH] Ensure Jid is Hash-able MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 700edaad..ec56a71e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,7 +50,7 @@ impl fmt::Display for JidParseError { } /// An enum representing a Jabber ID. It can be either a `FullJid` or a `BareJid`. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Jid { /// Bare Jid Bare(BareJid), @@ -624,6 +624,7 @@ mod tests { use super::*; use std::str::FromStr; + use std::collections::HashMap; #[test] fn can_parse_full_jids() { @@ -736,6 +737,11 @@ mod tests { assert_eq!(String::from(BareJid::new("a", "b")), String::from("a@b")); } + #[test] + fn hash() { + let _map: HashMap = HashMap::new(); + } + #[test] fn invalid_jids() { assert_eq!(BareJid::from_str(""), Err(JidParseError::NoDomain));