Skip to content

Commit

Permalink
impl Hash for ServiceAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
direc85 committed Jun 25, 2024
1 parent ecc1f98 commit b4e5a71
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libsignal-service/src/service_address.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::convert::TryFrom;
use std::{convert::TryFrom, hash::Hash, hash::Hasher};

use libsignal_protocol::{DeviceId, ProtocolAddress};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -138,3 +138,9 @@ impl TryFrom<Option<&[u8]>> for ServiceAddress {
}
}
}

impl Hash for ServiceAddress {
fn hash<H: Hasher>(&self, state: &mut H) {
self.to_service_id().hash(state);
}
}

0 comments on commit b4e5a71

Please sign in to comment.