@@ -70,14 +70,14 @@ pub trait ExtendedHasher: Hasher {
7070///
7171/// ```
7272/// use rustc_stable_hash::hashers::{StableSipHasher128, SipHasher128Hash};
73- /// use rustc_stable_hash::{StableHasher, StableHasherResult };
73+ /// use rustc_stable_hash::{StableHasher, FromStableHash };
7474/// use std::hash::Hasher;
7575///
7676/// struct Hash128([u64; 2]);
77- /// impl StableHasherResult for Hash128 {
77+ /// impl FromStableHash for Hash128 {
7878/// type Hash = SipHasher128Hash;
7979///
80- /// fn finish (SipHasher128Hash(hash): SipHasher128Hash) -> Hash128 {
80+ /// fn from (SipHasher128Hash(hash): SipHasher128Hash) -> Hash128 {
8181/// Hash128(hash)
8282/// }
8383/// }
@@ -92,32 +92,32 @@ pub struct StableHasher<H: ExtendedHasher> {
9292 state : H ,
9393}
9494
95- /// Trait for retrieving the result of the stable hashing operation.
95+ /// Trait for processing the result of the stable hashing operation.
9696///
9797/// # Example
9898///
9999/// ```
100- /// use rustc_stable_hash::{StableHasher, StableHasherResult };
100+ /// use rustc_stable_hash::{StableHasher, FromStableHash };
101101///
102102/// struct Hash128(u128);
103103///
104- /// impl StableHasherResult for Hash128 {
104+ /// impl FromStableHash for Hash128 {
105105/// type Hash = [u64; 2];
106106///
107- /// fn finish (hash: [u64; 2]) -> Hash128 {
107+ /// fn from (hash: [u64; 2]) -> Hash128 {
108108/// let upper: u128 = hash[0] as u128;
109109/// let lower: u128 = hash[1] as u128;
110110///
111111/// Hash128((upper << 64) | lower)
112112/// }
113113/// }
114114/// ```
115- pub trait StableHasherResult : Sized {
115+ pub trait FromStableHash : Sized {
116116 type Hash ;
117117
118- /// Retrieving the finalized state of the [`StableHasher`] and construct
119- /// an [`Self`] containing the hash.
120- fn finish ( hash : Self :: Hash ) -> Self ;
118+ /// Convert the finalized state of a [`StableHasher`] and construct
119+ /// an [`Self`] containing the processed hash.
120+ fn from ( hash : Self :: Hash ) -> Self ;
121121}
122122
123123impl < H : ExtendedHasher + Default > StableHasher < H > {
@@ -161,13 +161,13 @@ impl<H: ExtendedHasher> StableHasher<H> {
161161 /// Returns the typed-hash value for the values written.
162162 ///
163163 /// The resulting typed-hash value is constructed from an
164- /// [`StableHasherResult `] implemenation.
164+ /// [`FromStableHash `] implemenation.
165165 ///
166166 /// To be used in-place of [`Hasher::finish`].
167167 #[ inline]
168168 #[ must_use]
169- pub fn finish < W : StableHasherResult < Hash = H :: Hash > > ( self ) -> W {
170- W :: finish ( self . state . finish ( ) )
169+ pub fn finish < W : FromStableHash < Hash = H :: Hash > > ( self ) -> W {
170+ W :: from ( self . state . finish ( ) )
171171 }
172172}
173173
0 commit comments