Skip to content

Commit d74a4da

Browse files
authored
Merge pull request #349 from waywardmonkeys/improve-doc-formatting
docs: Improve doc formatting with backticks
2 parents 15518f3 + 5b0ed20 commit d74a4da

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/map.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ impl<K, V, S> IndexMap<K, V, S> {
11491149

11501150
/// Get a key-value pair by index
11511151
///
1152-
/// Valid indices are *0 <= index < self.len()*
1152+
/// Valid indices are `0 <= index < self.len()`.
11531153
///
11541154
/// Computes in **O(1)** time.
11551155
pub fn get_index(&self, index: usize) -> Option<(&K, &V)> {
@@ -1158,7 +1158,7 @@ impl<K, V, S> IndexMap<K, V, S> {
11581158

11591159
/// Get a key-value pair by index
11601160
///
1161-
/// Valid indices are *0 <= index < self.len()*
1161+
/// Valid indices are `0 <= index < self.len()`.
11621162
///
11631163
/// Computes in **O(1)** time.
11641164
pub fn get_index_mut(&mut self, index: usize) -> Option<(&K, &mut V)> {
@@ -1167,7 +1167,7 @@ impl<K, V, S> IndexMap<K, V, S> {
11671167

11681168
/// Get an entry in the map by index for in-place manipulation.
11691169
///
1170-
/// Valid indices are *0 <= index < self.len()*
1170+
/// Valid indices are `0 <= index < self.len()`.
11711171
///
11721172
/// Computes in **O(1)** time.
11731173
pub fn get_index_entry(&mut self, index: usize) -> Option<IndexedEntry<'_, K, V>> {
@@ -1179,7 +1179,7 @@ impl<K, V, S> IndexMap<K, V, S> {
11791179

11801180
/// Returns a slice of key-value pairs in the given range of indices.
11811181
///
1182-
/// Valid indices are *0 <= index < self.len()*
1182+
/// Valid indices are `0 <= index < self.len()`.
11831183
///
11841184
/// Computes in **O(1)** time.
11851185
pub fn get_range<R: RangeBounds<usize>>(&self, range: R) -> Option<&Slice<K, V>> {
@@ -1190,7 +1190,7 @@ impl<K, V, S> IndexMap<K, V, S> {
11901190

11911191
/// Returns a mutable slice of key-value pairs in the given range of indices.
11921192
///
1193-
/// Valid indices are *0 <= index < self.len()*
1193+
/// Valid indices are `0 <= index < self.len()`.
11941194
///
11951195
/// Computes in **O(1)** time.
11961196
pub fn get_range_mut<R: RangeBounds<usize>>(&mut self, range: R) -> Option<&mut Slice<K, V>> {
@@ -1245,7 +1245,7 @@ impl<K, V, S> IndexMap<K, V, S> {
12451245

12461246
/// Remove the key-value pair by index
12471247
///
1248-
/// Valid indices are *0 <= index < self.len()*
1248+
/// Valid indices are `0 <= index < self.len()`.
12491249
///
12501250
/// Like [`Vec::swap_remove`], the pair is removed by swapping it with the
12511251
/// last element of the map and popping it off. **This perturbs
@@ -1258,7 +1258,7 @@ impl<K, V, S> IndexMap<K, V, S> {
12581258

12591259
/// Remove the key-value pair by index
12601260
///
1261-
/// Valid indices are *0 <= index < self.len()*
1261+
/// Valid indices are `0 <= index < self.len()`.
12621262
///
12631263
/// Like [`Vec::remove`], the pair is removed by shifting all of the
12641264
/// elements that follow it, preserving their relative order.

src/map/mutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub trait MutableKeys: private::Sealed {
3232

3333
/// Return mutable reference to key and value at an index.
3434
///
35-
/// Valid indices are *0 <= index < self.len()*
35+
/// Valid indices are `0 <= index < self.len()`.
3636
///
3737
/// Computes in **O(1)** time.
3838
fn get_index_mut2(&mut self, index: usize) -> Option<(&mut Self::Key, &mut Self::Value)>;

src/map/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,29 @@ impl<K, V> Slice<K, V> {
7373

7474
/// Get a key-value pair by index.
7575
///
76-
/// Valid indices are *0 <= index < self.len()*
76+
/// Valid indices are `0 <= index < self.len()`.
7777
pub fn get_index(&self, index: usize) -> Option<(&K, &V)> {
7878
self.entries.get(index).map(Bucket::refs)
7979
}
8080

8181
/// Get a key-value pair by index, with mutable access to the value.
8282
///
83-
/// Valid indices are *0 <= index < self.len()*
83+
/// Valid indices are `0 <= index < self.len()`.
8484
pub fn get_index_mut(&mut self, index: usize) -> Option<(&K, &mut V)> {
8585
self.entries.get_mut(index).map(Bucket::ref_mut)
8686
}
8787

8888
/// Returns a slice of key-value pairs in the given range of indices.
8989
///
90-
/// Valid indices are *0 <= index < self.len()*
90+
/// Valid indices are `0 <= index < self.len()`.
9191
pub fn get_range<R: RangeBounds<usize>>(&self, range: R) -> Option<&Self> {
9292
let range = try_simplify_range(range, self.entries.len())?;
9393
self.entries.get(range).map(Slice::from_slice)
9494
}
9595

9696
/// Returns a mutable slice of key-value pairs in the given range of indices.
9797
///
98-
/// Valid indices are *0 <= index < self.len()*
98+
/// Valid indices are `0 <= index < self.len()`.
9999
pub fn get_range_mut<R: RangeBounds<usize>>(&mut self, range: R) -> Option<&mut Self> {
100100
let range = try_simplify_range(range, self.entries.len())?;
101101
self.entries.get_mut(range).map(Slice::from_mut_slice)

src/set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ impl<T, S> IndexSet<T, S> {
983983

984984
/// Get a value by index
985985
///
986-
/// Valid indices are *0 <= index < self.len()*
986+
/// Valid indices are `0 <= index < self.len()`.
987987
///
988988
/// Computes in **O(1)** time.
989989
pub fn get_index(&self, index: usize) -> Option<&T> {
@@ -992,7 +992,7 @@ impl<T, S> IndexSet<T, S> {
992992

993993
/// Returns a slice of values in the given range of indices.
994994
///
995-
/// Valid indices are *0 <= index < self.len()*
995+
/// Valid indices are `0 <= index < self.len()`.
996996
///
997997
/// Computes in **O(1)** time.
998998
pub fn get_range<R: RangeBounds<usize>>(&self, range: R) -> Option<&Slice<T>> {
@@ -1017,7 +1017,7 @@ impl<T, S> IndexSet<T, S> {
10171017

10181018
/// Remove the value by index
10191019
///
1020-
/// Valid indices are *0 <= index < self.len()*
1020+
/// Valid indices are `0 <= index < self.len()`.
10211021
///
10221022
/// Like [`Vec::swap_remove`], the value is removed by swapping it with the
10231023
/// last element of the set and popping it off. **This perturbs
@@ -1030,7 +1030,7 @@ impl<T, S> IndexSet<T, S> {
10301030

10311031
/// Remove the value by index
10321032
///
1033-
/// Valid indices are *0 <= index < self.len()*
1033+
/// Valid indices are `0 <= index < self.len()`.
10341034
///
10351035
/// Like [`Vec::remove`], the value is removed by shifting all of the
10361036
/// elements that follow it, preserving their relative order.

src/set/mutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub trait MutableValues: private::Sealed {
2929

3030
/// Return mutable reference to the value at an index.
3131
///
32-
/// Valid indices are *0 <= index < self.len()*
32+
/// Valid indices are `0 <= index < self.len()`.
3333
///
3434
/// Computes in **O(1)** time.
3535
fn get_index_mut2(&mut self, index: usize) -> Option<&mut Self::Value>;

src/set/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ impl<T> Slice<T> {
5959

6060
/// Get a value by index.
6161
///
62-
/// Valid indices are *0 <= index < self.len()*
62+
/// Valid indices are `0 <= index < self.len()`.
6363
pub fn get_index(&self, index: usize) -> Option<&T> {
6464
self.entries.get(index).map(Bucket::key_ref)
6565
}
6666

6767
/// Returns a slice of values in the given range of indices.
6868
///
69-
/// Valid indices are *0 <= index < self.len()*
69+
/// Valid indices are `0 <= index < self.len()`.
7070
pub fn get_range<R: RangeBounds<usize>>(&self, range: R) -> Option<&Self> {
7171
let range = try_simplify_range(range, self.entries.len())?;
7272
self.entries.get(range).map(Self::from_slice)

0 commit comments

Comments
 (0)