This commit is contained in:
ripytide
2023-03-31 16:43:40 +01:00
parent 2e613e3833
commit db5d5d33c5
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -66,12 +66,12 @@ fn bench_insert_merge_touching_or_overlapping(b: &mut Bencher) {
}
#[bench]
fn bench_overwrite(b: &mut Bencher) {
fn bench_insert_overwrite(b: &mut Bencher) {
b.iter(|| {
let mut map = RangeBoundsMap::new();
for i in 0..REPEAT {
let r = i..i + 2;
map.overwrite(r, i).expect("insert failed");
map.insert_overwrite(r, i).expect("insert failed");
}
});
}
+2 -2
View File
@@ -1341,7 +1341,7 @@ where
/// let mut range_bounds_map =
/// RangeBoundsMap::try_from([(2..8, false)]).unwrap();
///
/// assert_eq!(range_bounds_map.overwrite(4..6, true), Ok(()));
/// assert_eq!(range_bounds_map.insert_overwrite(4..6, true), Ok(()));
///
/// assert_eq!(
/// range_bounds_map.iter().collect::<Vec<_>>(),
@@ -1349,7 +1349,7 @@ where
/// );
/// ```
#[trivial]
pub fn overwrite(
pub fn insert_overwrite(
&mut self,
range_bounds: K,
value: V,
+3 -3
View File
@@ -705,7 +705,7 @@ where
/// let mut range_bounds_set =
/// RangeBoundsSet::try_from([2..8]).unwrap();
///
/// assert_eq!(range_bounds_set.overwrite(4..6), Ok(()));
/// assert_eq!(range_bounds_set.insert_overwrite(4..6), Ok(()));
///
/// assert_eq!(
/// range_bounds_set.iter().collect::<Vec<_>>(),
@@ -713,14 +713,14 @@ where
/// );
/// ```
#[trivial]
pub fn overwrite(
pub fn insert_overwrite(
&mut self,
range_bounds: K,
) -> Result<(), TryFromBoundsError>
where
K: TryFromBounds<I>,
{
self.map.overwrite(range_bounds, ())
self.map.insert_overwrite(range_bounds, ())
}
/// Returns the first `RangeBounds` in the set, if any.
+1 -1
View File
@@ -3,7 +3,7 @@
- try to remove unnecessary uses of cloned()
- use expand, expand_cloned and cloned_bounds everywhere
- replace instances of |(key, \_)| with fn first()
- rename overwrite to insert_forceful
- rename insert_overwrite to insert_forceful
- make all iterators cutsom types as is standardised in libraries for
some reason(?)
- take a look around idiomatic rust for a bit