From 5cdd138a65422019197b479a8d6bc8b18a609f46 Mon Sep 17 00:00:00 2001 From: Sean Olson Date: Fri, 26 Jul 2024 14:32:22 -0700 Subject: [PATCH] Respell `Segment` types trait implementations. This change respells `Segment` types in `Segmentation` and `SegmentedBy` implementations using type definitions for the corresponding collection. This makes documentation a bit clearer. --- src/array_vec1.rs | 12 ++++++------ src/btree_map1.rs | 12 ++++++------ src/btree_set1.rs | 12 ++++++------ src/vec1.rs | 12 ++++++------ src/vec_deque1.rs | 12 ++++++------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/array_vec1.rs b/src/array_vec1.rs index cf2e112..536bb06 100644 --- a/src/array_vec1.rs +++ b/src/array_vec1.rs @@ -34,11 +34,11 @@ impl Ranged for ArrayVec { } impl Segmentation for ArrayVec { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> ArrayVecSegment<'_, T, N> { self.segment(Ranged::tail(self)) } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> ArrayVecSegment<'_, T, N> { self.segment(Ranged::rtail(self)) } } @@ -52,7 +52,7 @@ impl segment::SegmentedBy for ArrayVec where R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> ArrayVecSegment<'_, T, N> { Segment::intersect(self, &range::ordered_range_offsets(range)) } } @@ -442,11 +442,11 @@ impl Segmentation for ArrayVec1 where [T; N]: Array1, { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> ArrayVec1Segment<'_, T, N> { self.segment(Ranged::tail(&self.items)) } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> ArrayVec1Segment<'_, T, N> { self.segment(Ranged::rtail(&self.items)) } } @@ -464,7 +464,7 @@ where [T; N]: Array1, R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> ArrayVec1Segment<'_, T, N> { Segment::intersect_strict_subset(&mut self.items, &range::ordered_range_offsets(range)) } } diff --git a/src/btree_map1.rs b/src/btree_map1.rs index 63a17d6..7155521 100644 --- a/src/btree_map1.rs +++ b/src/btree_map1.rs @@ -54,14 +54,14 @@ impl Segmentation for BTreeMap where K: Copy + Ord, { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> BTreeMapSegment<'_, K, V> { match Ranged::tail(self).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(self), } } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> BTreeMapSegment<'_, K, V> { match Ranged::rtail(self).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(self), @@ -86,7 +86,7 @@ where K: Copy + Ord, R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> BTreeMapSegment<'_, K, V> { Segment::intersect(self, &range::ordered_range_bounds(range)) } } @@ -700,14 +700,14 @@ impl Segmentation for BTreeMap1 where K: Copy + Ord, { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> BTreeMap1Segment<'_, K, V> { match Ranged::tail(&self.items).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(&mut self.items), } } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> BTreeMap1Segment<'_, K, V> { match Ranged::rtail(&self.items).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(&mut self.items), @@ -729,7 +729,7 @@ where K: Copy + Ord, R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> BTreeMap1Segment<'_, K, V> { Segment::intersect_strict_subset(&mut self.items, &range::ordered_range_bounds(range)) } } diff --git a/src/btree_set1.rs b/src/btree_set1.rs index 9a3e1c2..143e0f6 100644 --- a/src/btree_set1.rs +++ b/src/btree_set1.rs @@ -45,14 +45,14 @@ impl Segmentation for BTreeSet where T: Copy + Ord, { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> BTreeSetSegment<'_, T> { match Ranged::tail(self).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(self), } } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> BTreeSetSegment<'_, T> { match Ranged::rtail(self).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(self), @@ -77,7 +77,7 @@ where T: Copy + Ord, R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> BTreeSetSegment<'_, T> { Segment::intersect(self, &range::ordered_range_bounds(range)) } } @@ -449,14 +449,14 @@ impl Segmentation for BTreeSet1 where T: Copy + Ord, { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> BTreeSet1Segment<'_, T> { match Ranged::tail(&self.items).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(&mut self.items), } } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> BTreeSet1Segment<'_, T> { match Ranged::rtail(&self.items).try_into_range_inclusive() { Some(range) => self.segment(range), _ => Segment::empty(&mut self.items), @@ -478,7 +478,7 @@ where T: Copy + Ord, R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> BTreeSet1Segment<'_, T> { Segment::intersect_strict_subset(&mut self.items, &range::ordered_range_bounds(range)) } } diff --git a/src/vec1.rs b/src/vec1.rs index 54829f6..a6b1853 100644 --- a/src/vec1.rs +++ b/src/vec1.rs @@ -40,11 +40,11 @@ impl Ranged for Vec { } impl Segmentation for Vec { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> VecSegment<'_, T> { self.segment(Ranged::tail(self)) } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> VecSegment<'_, T> { self.segment(Ranged::rtail(self)) } } @@ -58,7 +58,7 @@ impl segment::SegmentedBy for Vec where R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> VecSegment<'_, T> { Segment::intersect(self, &range::ordered_range_offsets(range)) } } @@ -440,11 +440,11 @@ impl IntoIterator1 for Vec1 { } impl Segmentation for Vec1 { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> Vec1Segment<'_, T> { self.segment(Ranged::tail(&self.items)) } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> Vec1Segment<'_, T> { self.segment(Ranged::rtail(&self.items)) } } @@ -458,7 +458,7 @@ impl segment::SegmentedBy for Vec1 where R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> Vec1Segment<'_, T> { Segment::intersect_strict_subset(&mut self.items, &range::ordered_range_offsets(range)) } } diff --git a/src/vec_deque1.rs b/src/vec_deque1.rs index 5f4275f..1fb8520 100644 --- a/src/vec_deque1.rs +++ b/src/vec_deque1.rs @@ -34,11 +34,11 @@ impl Ranged for VecDeque { } impl Segmentation for VecDeque { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> VecDequeSegment<'_, T> { Segment::intersect(self, &Ranged::tail(self)) } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> VecDequeSegment<'_, T> { Segment::intersect(self, &Ranged::rtail(self)) } } @@ -52,7 +52,7 @@ impl segment::SegmentedBy for VecDeque where R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> VecDequeSegment<'_, T> { Segment::intersect(self, &range::ordered_range_offsets(range)) } } @@ -334,12 +334,12 @@ impl IntoIterator1 for VecDeque1 { } impl Segmentation for VecDeque1 { - fn tail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn tail(&mut self) -> VecDeque1Segment<'_, T> { let range = Ranged::tail(&self.items); Segment::intersect_strict_subset(&mut self.items, &range) } - fn rtail(&mut self) -> Segment<'_, Self::Kind, Self::Target> { + fn rtail(&mut self) -> VecDeque1Segment<'_, T> { let range = Ranged::rtail(&self.items); Segment::intersect_strict_subset(&mut self.items, &range) } @@ -354,7 +354,7 @@ impl segment::SegmentedBy for VecDeque1 where R: RangeBounds, { - fn segment(&mut self, range: R) -> Segment<'_, Self::Kind, Self::Target> { + fn segment(&mut self, range: R) -> VecDeque1Segment<'_, T> { Segment::intersect_strict_subset(&mut self.items, &range::ordered_range_offsets(range)) } }