1use std::cmp::Ordering;
2use std::fmt;
3use std::hash::{Hash, Hasher};
4use std::marker::PhantomData;
5
6use digest::Digest;
7
8pub struct HashChoice<H: Digest + Clone>(PhantomData<fn(H)>);
10
11impl<H: Digest + Clone> Default for HashChoice<H> {
12 fn default() -> Self {
13 Self(PhantomData)
14 }
15}
16
17impl<H: Digest + Clone> HashChoice<H> {
18 pub fn new() -> Self {
19 Self::default()
20 }
21}
22
23impl<H: Digest + Clone> Clone for HashChoice<H> {
24 fn clone(&self) -> Self {
25 Self::default()
26 }
27}
28
29impl<H: Digest + Clone> fmt::Debug for HashChoice<H> {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 write!(f, "HashChoice<_>")
32 }
33}
34
35impl<H: Digest + Clone> PartialEq for HashChoice<H> {
36 fn eq(&self, _other: &Self) -> bool {
37 true
38 }
39}
40
41impl<H: Digest + Clone> Eq for HashChoice<H> {}
42
43impl<H: Digest + Clone> PartialOrd for HashChoice<H> {
44 fn partial_cmp(&self, _other: &Self) -> Option<Ordering> {
45 Some(Ordering::Equal)
46 }
47}
48
49impl<H: Digest + Clone> Ord for HashChoice<H> {
50 fn cmp(&self, _other: &Self) -> Ordering {
51 Ordering::Equal
52 }
53}
54
55impl<H: Digest + Clone> Hash for HashChoice<H> {
56 fn hash<N: Hasher>(&self, _state: &mut N) {}
57}