Skip to content

Commit 00098bd

Browse files
Add missing urls for hash modules
1 parent 4a9af01 commit 00098bd

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

src/libcore/hash/mod.rs

+22-15
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
//! ```
3939
//!
4040
//! If you need more control over how a value is hashed, you need to implement
41-
//! the `Hash` trait:
41+
//! the [`Hash`] trait:
42+
//!
43+
//! [`Hash`]: trait.Hash.html
4244
//!
4345
//! ```rust
4446
//! use std::hash::{Hash, Hasher, SipHasher};
@@ -90,21 +92,21 @@ mod sip;
9092
/// The `H` type parameter is an abstract hash state that is used by the `Hash`
9193
/// to compute the hash.
9294
///
93-
/// If you are also implementing `Eq`, there is an additional property that
95+
/// If you are also implementing [`Eq`], there is an additional property that
9496
/// is important:
9597
///
9698
/// ```text
9799
/// k1 == k2 -> hash(k1) == hash(k2)
98100
/// ```
99101
///
100102
/// In other words, if two keys are equal, their hashes should also be equal.
101-
/// `HashMap` and `HashSet` both rely on this behavior.
103+
/// [`HashMap`] and [`HashSet`] both rely on this behavior.
102104
///
103105
/// ## Derivable
104106
///
105107
/// This trait can be used with `#[derive]` if all fields implement `Hash`.
106108
/// When `derive`d, the resulting hash will be the combination of the values
107-
/// from calling `.hash()` on each field.
109+
/// from calling [`.hash()`] on each field.
108110
///
109111
/// ## How can I implement `Hash`?
110112
///
@@ -127,6 +129,11 @@ mod sip;
127129
/// }
128130
/// }
129131
/// ```
132+
///
133+
/// [`Eq`]: ../../std/cmp/trait.Eq.html
134+
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
135+
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
136+
/// [`.hash()`]: #tymethod.hash
130137
#[stable(feature = "rust1", since = "1.0.0")]
131138
pub trait Hash {
132139
/// Feeds this value into the state given, updating the hasher as necessary.
@@ -151,35 +158,35 @@ pub trait Hasher {
151158
#[stable(feature = "rust1", since = "1.0.0")]
152159
fn finish(&self) -> u64;
153160

154-
/// Writes some data into this `Hasher`
161+
/// Writes some data into this `Hasher`.
155162
#[stable(feature = "rust1", since = "1.0.0")]
156163
fn write(&mut self, bytes: &[u8]);
157164

158-
/// Write a single `u8` into this hasher
165+
/// Write a single `u8` into this hasher.
159166
#[inline]
160167
#[stable(feature = "hasher_write", since = "1.3.0")]
161168
fn write_u8(&mut self, i: u8) {
162169
self.write(&[i])
163170
}
164-
/// Write a single `u16` into this hasher.
171+
/// Writes a single `u16` into this hasher.
165172
#[inline]
166173
#[stable(feature = "hasher_write", since = "1.3.0")]
167174
fn write_u16(&mut self, i: u16) {
168175
self.write(&unsafe { mem::transmute::<_, [u8; 2]>(i) })
169176
}
170-
/// Write a single `u32` into this hasher.
177+
/// Writes a single `u32` into this hasher.
171178
#[inline]
172179
#[stable(feature = "hasher_write", since = "1.3.0")]
173180
fn write_u32(&mut self, i: u32) {
174181
self.write(&unsafe { mem::transmute::<_, [u8; 4]>(i) })
175182
}
176-
/// Write a single `u64` into this hasher.
183+
/// Writes a single `u64` into this hasher.
177184
#[inline]
178185
#[stable(feature = "hasher_write", since = "1.3.0")]
179186
fn write_u64(&mut self, i: u64) {
180187
self.write(&unsafe { mem::transmute::<_, [u8; 8]>(i) })
181188
}
182-
/// Write a single `usize` into this hasher.
189+
/// Writes a single `usize` into this hasher.
183190
#[inline]
184191
#[stable(feature = "hasher_write", since = "1.3.0")]
185192
fn write_usize(&mut self, i: usize) {
@@ -189,31 +196,31 @@ pub trait Hasher {
189196
self.write(bytes);
190197
}
191198

192-
/// Write a single `i8` into this hasher.
199+
/// Writes a single `i8` into this hasher.
193200
#[inline]
194201
#[stable(feature = "hasher_write", since = "1.3.0")]
195202
fn write_i8(&mut self, i: i8) {
196203
self.write_u8(i as u8)
197204
}
198-
/// Write a single `i16` into this hasher.
205+
/// Writes a single `i16` into this hasher.
199206
#[inline]
200207
#[stable(feature = "hasher_write", since = "1.3.0")]
201208
fn write_i16(&mut self, i: i16) {
202209
self.write_u16(i as u16)
203210
}
204-
/// Write a single `i32` into this hasher.
211+
/// Writes a single `i32` into this hasher.
205212
#[inline]
206213
#[stable(feature = "hasher_write", since = "1.3.0")]
207214
fn write_i32(&mut self, i: i32) {
208215
self.write_u32(i as u32)
209216
}
210-
/// Write a single `i64` into this hasher.
217+
/// Writes a single `i64` into this hasher.
211218
#[inline]
212219
#[stable(feature = "hasher_write", since = "1.3.0")]
213220
fn write_i64(&mut self, i: i64) {
214221
self.write_u64(i as u64)
215222
}
216-
/// Write a single `isize` into this hasher.
223+
/// Writes a single `isize` into this hasher.
217224
#[inline]
218225
#[stable(feature = "hasher_write", since = "1.3.0")]
219226
fn write_isize(&mut self, i: isize) {

0 commit comments

Comments
 (0)