@@ -174,8 +174,10 @@ impl PasswordHash {
174174 } )
175175 }
176176
177- /// Serialize this [`PasswordHash`] as a [`PasswordHashString`].
177+ /// DEPRECATED: serialize this [`PasswordHash`] as a [`PasswordHashString`].
178+ #[ allow( deprecated) ]
178179 #[ cfg( feature = "alloc" ) ]
180+ #[ deprecated( since = "0.3.0" , note = "Use `PasswordHash` or `String` instead" ) ]
179181 pub fn serialize ( & self ) -> PasswordHashString {
180182 self . into ( )
181183 }
@@ -221,11 +223,15 @@ impl fmt::Display for PasswordHash {
221223 }
222224}
223225
224- /// Serialized [`PasswordHash`].
226+ /// DEPRECATED: serialized [`PasswordHash`].
225227///
226228/// This type contains a serialized password hash string which is ensured to
227229/// parse successfully.
228- // TODO(tarcieri): cached parsed representations? or at least structural data
230+ ///
231+ /// This was originally available to provide an owned representation for a password hash, but now
232+ /// that [`PasswordHash`] is fully owned, it can be used instead, or `String` to store a
233+ /// serialized PHC string.
234+ #[ deprecated( since = "0.3.0" , note = "Use `PasswordHash` or `String` instead" ) ]
229235#[ cfg( feature = "alloc" ) ]
230236#[ derive( Clone , Debug , Eq , PartialEq ) ]
231237pub struct PasswordHashString {
@@ -234,7 +240,7 @@ pub struct PasswordHashString {
234240}
235241
236242#[ cfg( feature = "alloc" ) ]
237- #[ allow( clippy:: len_without_is_empty) ]
243+ #[ allow( clippy:: len_without_is_empty, deprecated ) ]
238244impl PasswordHashString {
239245 /// Parse a password hash from a string in the PHC string format.
240246 pub fn new ( s : & str ) -> Result < Self > {
@@ -287,20 +293,23 @@ impl PasswordHashString {
287293 }
288294}
289295
296+ #[ allow( deprecated) ]
290297#[ cfg( feature = "alloc" ) ]
291298impl AsRef < str > for PasswordHashString {
292299 fn as_ref ( & self ) -> & str {
293300 self . as_str ( )
294301 }
295302}
296303
304+ #[ allow( deprecated) ]
297305#[ cfg( feature = "alloc" ) ]
298306impl From < PasswordHash > for PasswordHashString {
299307 fn from ( hash : PasswordHash ) -> PasswordHashString {
300308 PasswordHashString :: from ( & hash)
301309 }
302310}
303311
312+ #[ allow( deprecated) ]
304313#[ cfg( feature = "alloc" ) ]
305314impl From < & PasswordHash > for PasswordHashString {
306315 fn from ( hash : & PasswordHash ) -> PasswordHashString {
@@ -310,6 +319,7 @@ impl From<&PasswordHash> for PasswordHashString {
310319 }
311320}
312321
322+ #[ allow( deprecated) ]
313323#[ cfg( feature = "alloc" ) ]
314324impl FromStr for PasswordHashString {
315325 type Err = Error ;
@@ -319,6 +329,7 @@ impl FromStr for PasswordHashString {
319329 }
320330}
321331
332+ #[ allow( deprecated) ]
322333#[ cfg( feature = "alloc" ) ]
323334impl fmt:: Display for PasswordHashString {
324335 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
0 commit comments