39
39
//! If you need more control over how a value is hashed, you need to implement
40
40
//! the [`Hash`] trait:
41
41
//!
42
- //! [`Hash`]: trait.Hash.html
43
- //!
44
42
//! ```rust
45
43
//! use std::collections::hash_map::DefaultHasher;
46
44
//! use std::hash::{Hash, Hasher};
@@ -149,11 +147,9 @@ mod sip;
149
147
/// Thankfully, you won't need to worry about upholding this property when
150
148
/// deriving both [`Eq`] and `Hash` with `#[derive(PartialEq, Eq, Hash)]`.
151
149
///
152
- /// [`Eq`]: ../../std/cmp/trait.Eq.html
153
- /// [`Hasher`]: trait.Hasher.html
154
150
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
155
151
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
156
- /// [`hash`]: #tymethod. hash
152
+ /// [`hash`]: Hash:: hash
157
153
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
158
154
pub trait Hash {
159
155
/// Feeds this value into the given [`Hasher`].
@@ -168,8 +164,6 @@ pub trait Hash {
168
164
/// 7920.hash(&mut hasher);
169
165
/// println!("Hash is {:x}!", hasher.finish());
170
166
/// ```
171
- ///
172
- /// [`Hasher`]: trait.Hasher.html
173
167
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
174
168
fn hash < H : Hasher > ( & self , state : & mut H ) ;
175
169
@@ -186,8 +180,6 @@ pub trait Hash {
186
180
/// Hash::hash_slice(&numbers, &mut hasher);
187
181
/// println!("Hash is {:x}!", hasher.finish());
188
182
/// ```
189
- ///
190
- /// [`Hasher`]: trait.Hasher.html
191
183
#[ stable( feature = "hash_slice" , since = "1.3.0" ) ]
192
184
fn hash_slice < H : Hasher > ( data : & [ Self ] , state : & mut H )
193
185
where
@@ -239,10 +231,9 @@ pub use macros::Hash;
239
231
/// println!("Hash is {:x}!", hasher.finish());
240
232
/// ```
241
233
///
242
- /// [`Hash`]: trait.Hash.html
243
- /// [`finish`]: #tymethod.finish
244
- /// [`write`]: #tymethod.write
245
- /// [`write_u8`]: #method.write_u8
234
+ /// [`finish`]: Hasher::finish
235
+ /// [`write`]: Hasher::write
236
+ /// [`write_u8`]: Hasher::write_u8
246
237
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
247
238
pub trait Hasher {
248
239
/// Returns the hash value for the values written so far.
@@ -264,7 +255,7 @@ pub trait Hasher {
264
255
/// println!("Hash is {:x}!", hasher.finish());
265
256
/// ```
266
257
///
267
- /// [`write`]: #tymethod. write
258
+ /// [`write`]: Hasher:: write
268
259
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
269
260
fn finish ( & self ) -> u64 ;
270
261
@@ -433,8 +424,7 @@ impl<H: Hasher + ?Sized> Hasher for &mut H {
433
424
/// assert_eq!(hasher_1.finish(), hasher_2.finish());
434
425
/// ```
435
426
///
436
- /// [`build_hasher`]: #tymethod.build_hasher
437
- /// [`Hasher`]: trait.Hasher.html
427
+ /// [`build_hasher`]: BuildHasher::build_hasher
438
428
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
439
429
#[ stable( since = "1.7.0" , feature = "build_hasher" ) ]
440
430
pub trait BuildHasher {
@@ -456,8 +446,6 @@ pub trait BuildHasher {
456
446
/// let s = RandomState::new();
457
447
/// let new_s = s.build_hasher();
458
448
/// ```
459
- ///
460
- /// [`Hasher`]: trait.Hasher.html
461
449
#[ stable( since = "1.7.0" , feature = "build_hasher" ) ]
462
450
fn build_hasher ( & self ) -> Self :: Hasher ;
463
451
}
@@ -470,7 +458,7 @@ pub trait BuildHasher {
470
458
/// defined.
471
459
///
472
460
/// Any `BuildHasherDefault` is [zero-sized]. It can be created with
473
- /// [`default`][method.Default ]. When using `BuildHasherDefault` with [`HashMap`] or
461
+ /// [`default`][method.default ]. When using `BuildHasherDefault` with [`HashMap`] or
474
462
/// [`HashSet`], this doesn't need to be done, since they implement appropriate
475
463
/// [`Default`] instances themselves.
476
464
///
@@ -503,10 +491,7 @@ pub trait BuildHasher {
503
491
/// let hash_map = HashMap::<u32, u32, MyBuildHasher>::default();
504
492
/// ```
505
493
///
506
- /// [`BuildHasher`]: trait.BuildHasher.html
507
- /// [`Default`]: ../default/trait.Default.html
508
- /// [method.default]: #method.default
509
- /// [`Hasher`]: trait.Hasher.html
494
+ /// [method.default]: BuildHasherDefault::default
510
495
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
511
496
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
512
497
/// [zero-sized]: https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts
0 commit comments