Implement Hash for IVec
-use std::{fmt, ops::Deref, result::Result as StdResult, sync::Arc};
+use std::{
+ collections::hash_map::DefaultHasher,
+ fmt,
+ hash::{Hash, Hasher},
+ ops::Deref,
+ result::Result as StdResult,
+ sync::Arc,
+};
use serde::{
Deserialize, Serialize,
@@ -20,6 +27,12 @@ enum IVecInner {
Remote(Arc<[u8]>),
}
+impl Hash for IVec {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.deref().hash(state);
+ }
+}
+
impl Serialize for IVec {
fn serialize<S: Serializer>(
&self,
