blob: 22bcdd3bdcec4f2ef1cf8b5ae91a392affc6b557 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
use aws_sdk_route53::types::ResourceRecordSet;
pub trait SimpleHash {
fn hash<H: Hasher>(&self, state: &mut H);
}
#[derive(Debug, PartialEq, Clone)]
pub struct Hashable<T>(T);
impl<T> AsRef<T> for Hashable<T> {
fn as_ref(&self) -> &T {
&self.0
}
}
impl<T> Eq for Hashable<T> where Hashable<T>: PartialEq {}
impl<T: SimpleHash> Hash for Hashable<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.hash(state)
}
}
impl<T> From<T> for Hashable<T> {
fn from(value: T) -> Self {
Self(value)
}
}
impl SimpleHash for ResourceRecordSet {
fn hash<H: Hasher>(&self, state: &mut H) {
self.name().hash(state)
}
}
|