|
11 | 11 | //! connect the fact that they can only be produced by a `StableHasher` to their
|
12 | 12 | //! `Encode`/`Decode` impls.
|
13 | 13 |
|
14 |
| -use crate::stable_hasher::{StableHasher, StableHasherResult}; |
| 14 | +use crate::stable_hasher::{FromStableHash, StableHasherHash}; |
15 | 15 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
16 | 16 | use std::fmt;
|
17 | 17 | use std::ops::BitXorAssign;
|
@@ -56,10 +56,12 @@ impl<D: Decoder> Decodable<D> for Hash64 {
|
56 | 56 | }
|
57 | 57 | }
|
58 | 58 |
|
59 |
| -impl StableHasherResult for Hash64 { |
| 59 | +impl FromStableHash for Hash64 { |
| 60 | + type Hash = StableHasherHash; |
| 61 | + |
60 | 62 | #[inline]
|
61 |
| - fn finish(hasher: StableHasher) -> Self { |
62 |
| - Self { inner: hasher.finalize().0 } |
| 63 | + fn from(StableHasherHash([_0, __1]): Self::Hash) -> Self { |
| 64 | + Self { inner: _0 } |
63 | 65 | }
|
64 | 66 | }
|
65 | 67 |
|
@@ -121,10 +123,11 @@ impl<D: Decoder> Decodable<D> for Hash128 {
|
121 | 123 | }
|
122 | 124 | }
|
123 | 125 |
|
124 |
| -impl StableHasherResult for Hash128 { |
| 126 | +impl FromStableHash for Hash128 { |
| 127 | + type Hash = StableHasherHash; |
| 128 | + |
125 | 129 | #[inline]
|
126 |
| - fn finish(hasher: StableHasher) -> Self { |
127 |
| - let (_0, _1) = hasher.finalize(); |
| 130 | + fn from(StableHasherHash([_0, _1]): Self::Hash) -> Self { |
128 | 131 | Self { inner: u128::from(_0) | (u128::from(_1) << 64) }
|
129 | 132 | }
|
130 | 133 | }
|
|
0 commit comments