@@ -520,10 +520,9 @@ impl<T, S: HistoryBufStorage<T> + ?Sized> HistoryBufInner<T, S> {
520
520
/// assert_eq!(x, y)
521
521
/// }
522
522
/// ```
523
- pub fn oldest_ordered ( & self ) -> OldestOrderedInner < ' _ , T , S > {
523
+ pub fn oldest_ordered ( & self ) -> OldestOrdered < ' _ , T > {
524
524
let ( old, new) = self . as_slices ( ) ;
525
- OldestOrderedInner {
526
- phantom : PhantomData ,
525
+ OldestOrdered {
527
526
inner : old. iter ( ) . chain ( new) ,
528
527
}
529
528
}
@@ -612,62 +611,21 @@ where
612
611
}
613
612
}
614
613
615
- /// Base struct for [`OldestOrdered`] and [`OldestOrderedView`], generic over the [`HistoryBufStorage`].
616
- ///
617
- /// In most cases you should use [`OldestOrdered`] or [`OldestOrderedView`] directly. Only use this
618
- /// struct if you want to write code that's generic over both.
619
- pub struct OldestOrderedInner < ' a , T , S : HistoryBufStorage < T > + ?Sized > {
620
- phantom : PhantomData < S > ,
621
- inner : core:: iter:: Chain < core:: slice:: Iter < ' a , T > , core:: slice:: Iter < ' a , T > > ,
622
- }
623
-
624
614
/// Double ended iterator on the underlying buffer ordered from the oldest data
625
615
/// to the newest.
626
- ///
627
- /// This type exists for backwards compatibility. It is always better to convert it to an [`OldestOrderedView`] with [`into_view`](OldestOrdered::into_view)
628
- pub type OldestOrdered < ' a , T , const N : usize > =
629
- OldestOrderedInner < ' a , T , OwnedHistoryBufStorage < T , N > > ;
630
-
631
- /// Double ended iterator on the underlying buffer ordered from the oldest data
632
- /// to the newest
633
- pub type OldestOrderedView < ' a , T > = OldestOrderedInner < ' a , T , ViewHistoryBufStorage < T > > ;
634
-
635
- impl < ' a , T , const N : usize > OldestOrdered < ' a , T , N > {
636
- /// Remove the `N` const-generic parameter from the iterator
637
- ///
638
- /// For the opposite operation, see [`into_legacy_iter`](OldestOrderedView::into_legacy_iter)
639
- pub fn into_view ( self ) -> OldestOrderedView < ' a , T > {
640
- OldestOrderedView {
641
- phantom : PhantomData ,
642
- inner : self . inner ,
643
- }
644
- }
645
- }
646
-
647
- impl < ' a , T > OldestOrderedView < ' a , T > {
648
- /// Add back the `N` const-generic parameter to use it with APIs expecting the legacy type
649
- ///
650
- /// You probably do not need this
651
- ///
652
- /// For the opposite operation, see [`into_view`](OldestOrdered::into_view)
653
- pub fn into_legacy_iter < const N : usize > ( self ) -> OldestOrdered < ' a , T , N > {
654
- OldestOrdered {
655
- phantom : PhantomData ,
656
- inner : self . inner ,
657
- }
658
- }
616
+ pub struct OldestOrdered < ' a , T > {
617
+ inner : core:: iter:: Chain < core:: slice:: Iter < ' a , T > , core:: slice:: Iter < ' a , T > > ,
659
618
}
660
619
661
- impl < T , S : HistoryBufStorage < T > + ? Sized > Clone for OldestOrderedInner < ' _ , T , S > {
620
+ impl < T > Clone for OldestOrdered < ' _ , T > {
662
621
fn clone ( & self ) -> Self {
663
622
Self {
664
- phantom : PhantomData ,
665
623
inner : self . inner . clone ( ) ,
666
624
}
667
625
}
668
626
}
669
627
670
- impl < ' a , T , S : HistoryBufStorage < T > + ? Sized > Iterator for OldestOrderedInner < ' a , T , S > {
628
+ impl < ' a , T > Iterator for OldestOrdered < ' a , T > {
671
629
type Item = & ' a T ;
672
630
673
631
fn next ( & mut self ) -> Option < & ' a T > {
@@ -679,7 +637,7 @@ impl<'a, T, S: HistoryBufStorage<T> + ?Sized> Iterator for OldestOrderedInner<'a
679
637
}
680
638
}
681
639
682
- impl < T , const N : usize > DoubleEndedIterator for OldestOrdered < ' _ , T , N > {
640
+ impl < T > DoubleEndedIterator for OldestOrdered < ' _ , T > {
683
641
fn next_back ( & mut self ) -> Option < Self :: Item > {
684
642
self . inner . next_back ( )
685
643
}
0 commit comments