mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Ensure Jid is Hash-able
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
147d07832e
commit
176166b60a
1 changed files with 7 additions and 1 deletions
|
@ -50,7 +50,7 @@ impl fmt::Display for JidParseError {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum representing a Jabber ID. It can be either a `FullJid` or a `BareJid`.
|
/// 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 {
|
pub enum Jid {
|
||||||
/// Bare Jid
|
/// Bare Jid
|
||||||
Bare(BareJid),
|
Bare(BareJid),
|
||||||
|
@ -624,6 +624,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_parse_full_jids() {
|
fn can_parse_full_jids() {
|
||||||
|
@ -736,6 +737,11 @@ mod tests {
|
||||||
assert_eq!(String::from(BareJid::new("a", "b")), String::from("a@b"));
|
assert_eq!(String::from(BareJid::new("a", "b")), String::from("a@b"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hash() {
|
||||||
|
let _map: HashMap<Jid, String> = HashMap::new();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn invalid_jids() {
|
fn invalid_jids() {
|
||||||
assert_eq!(BareJid::from_str(""), Err(JidParseError::NoDomain));
|
assert_eq!(BareJid::from_str(""), Err(JidParseError::NoDomain));
|
||||||
|
|
Loading…
Reference in a new issue