From 5b0ed20b872618b0e57fa91f85228a174164fce8 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 17 Sep 2024 23:38:39 +0700 Subject: [PATCH] docs: Improve doc formatting with backticks --- src/map.rs | 14 +++++++------- src/map/mutable.rs | 2 +- src/map/slice.rs | 8 ++++---- src/set.rs | 8 ++++---- src/set/mutable.rs | 2 +- src/set/slice.rs | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/map.rs b/src/map.rs index 019c7f6d..946cb6fc 100644 --- a/src/map.rs +++ b/src/map.rs @@ -1149,7 +1149,7 @@ impl IndexMap { /// Get a key-value pair by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_index(&self, index: usize) -> Option<(&K, &V)> { @@ -1158,7 +1158,7 @@ impl IndexMap { /// Get a key-value pair by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_index_mut(&mut self, index: usize) -> Option<(&K, &mut V)> { @@ -1167,7 +1167,7 @@ impl IndexMap { /// Get an entry in the map by index for in-place manipulation. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_index_entry(&mut self, index: usize) -> Option> { @@ -1179,7 +1179,7 @@ impl IndexMap { /// Returns a slice of key-value pairs in the given range of indices. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_range>(&self, range: R) -> Option<&Slice> { @@ -1190,7 +1190,7 @@ impl IndexMap { /// Returns a mutable slice of key-value pairs in the given range of indices. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_range_mut>(&mut self, range: R) -> Option<&mut Slice> { @@ -1245,7 +1245,7 @@ impl IndexMap { /// Remove the key-value pair by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Like [`Vec::swap_remove`], the pair is removed by swapping it with the /// last element of the map and popping it off. **This perturbs @@ -1258,7 +1258,7 @@ impl IndexMap { /// Remove the key-value pair by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Like [`Vec::remove`], the pair is removed by shifting all of the /// elements that follow it, preserving their relative order. diff --git a/src/map/mutable.rs b/src/map/mutable.rs index 355eeb21..e429c8be 100644 --- a/src/map/mutable.rs +++ b/src/map/mutable.rs @@ -32,7 +32,7 @@ pub trait MutableKeys: private::Sealed { /// Return mutable reference to key and value at an index. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. fn get_index_mut2(&mut self, index: usize) -> Option<(&mut Self::Key, &mut Self::Value)>; diff --git a/src/map/slice.rs b/src/map/slice.rs index b2f00f48..94795b70 100644 --- a/src/map/slice.rs +++ b/src/map/slice.rs @@ -73,21 +73,21 @@ impl Slice { /// Get a key-value pair by index. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. pub fn get_index(&self, index: usize) -> Option<(&K, &V)> { self.entries.get(index).map(Bucket::refs) } /// Get a key-value pair by index, with mutable access to the value. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. pub fn get_index_mut(&mut self, index: usize) -> Option<(&K, &mut V)> { self.entries.get_mut(index).map(Bucket::ref_mut) } /// Returns a slice of key-value pairs in the given range of indices. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. pub fn get_range>(&self, range: R) -> Option<&Self> { let range = try_simplify_range(range, self.entries.len())?; self.entries.get(range).map(Slice::from_slice) @@ -95,7 +95,7 @@ impl Slice { /// Returns a mutable slice of key-value pairs in the given range of indices. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. pub fn get_range_mut>(&mut self, range: R) -> Option<&mut Self> { let range = try_simplify_range(range, self.entries.len())?; self.entries.get_mut(range).map(Slice::from_mut_slice) diff --git a/src/set.rs b/src/set.rs index 250e31b3..5a91db95 100644 --- a/src/set.rs +++ b/src/set.rs @@ -983,7 +983,7 @@ impl IndexSet { /// Get a value by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_index(&self, index: usize) -> Option<&T> { @@ -992,7 +992,7 @@ impl IndexSet { /// Returns a slice of values in the given range of indices. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. pub fn get_range>(&self, range: R) -> Option<&Slice> { @@ -1017,7 +1017,7 @@ impl IndexSet { /// Remove the value by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Like [`Vec::swap_remove`], the value is removed by swapping it with the /// last element of the set and popping it off. **This perturbs @@ -1030,7 +1030,7 @@ impl IndexSet { /// Remove the value by index /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Like [`Vec::remove`], the value is removed by shifting all of the /// elements that follow it, preserving their relative order. diff --git a/src/set/mutable.rs b/src/set/mutable.rs index 20eaa112..21615f34 100644 --- a/src/set/mutable.rs +++ b/src/set/mutable.rs @@ -29,7 +29,7 @@ pub trait MutableValues: private::Sealed { /// Return mutable reference to the value at an index. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. /// /// Computes in **O(1)** time. fn get_index_mut2(&mut self, index: usize) -> Option<&mut Self::Value>; diff --git a/src/set/slice.rs b/src/set/slice.rs index 9fc208c7..f980e974 100644 --- a/src/set/slice.rs +++ b/src/set/slice.rs @@ -59,14 +59,14 @@ impl Slice { /// Get a value by index. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. pub fn get_index(&self, index: usize) -> Option<&T> { self.entries.get(index).map(Bucket::key_ref) } /// Returns a slice of values in the given range of indices. /// - /// Valid indices are *0 <= index < self.len()* + /// Valid indices are `0 <= index < self.len()`. pub fn get_range>(&self, range: R) -> Option<&Self> { let range = try_simplify_range(range, self.entries.len())?; self.entries.get(range).map(Self::from_slice)