1- use crate :: { type_aliases :: PinVec , Doubly } ;
1+ use crate :: Doubly ;
22use core:: iter:: FusedIterator ;
3- use orx_selfref_col:: { CoreCol , NodePtr } ;
3+ use orx_pinned_vec:: PinnedVec ;
4+ use orx_selfref_col:: { CoreCol , Node , NodePtr } ;
45
56/// An ordered iterator over pointers to the elements of the doubly linked list.
67///
78/// Can be created by calling the `iter_ptr` method.
8- pub struct DoublyIterPtr < ' a , T > {
9- pub ( crate ) col : & ' a CoreCol < Doubly < T > , PinVec < Doubly < T > > > ,
9+ pub struct DoublyIterPtr < ' a , T , P >
10+ where
11+ P : PinnedVec < Node < Doubly < T > > > ,
12+ {
13+ pub ( crate ) col : & ' a CoreCol < Doubly < T > , P > ,
1014 current : Option < NodePtr < Doubly < T > > > ,
1115 current_back : Option < NodePtr < Doubly < T > > > ,
1216}
1317
14- impl < ' a , T > DoublyIterPtr < ' a , T > {
18+ impl < ' a , T , P > DoublyIterPtr < ' a , T , P >
19+ where
20+ P : PinnedVec < Node < Doubly < T > > > ,
21+ {
1522 pub ( crate ) fn new (
16- col : & ' a CoreCol < Doubly < T > , PinVec < Doubly < T > > > ,
23+ col : & ' a CoreCol < Doubly < T > , P > ,
1724 current : Option < NodePtr < Doubly < T > > > ,
1825 current_back : Option < NodePtr < Doubly < T > > > ,
1926 ) -> Self {
@@ -30,7 +37,10 @@ impl<'a, T> DoublyIterPtr<'a, T> {
3037 }
3138}
3239
33- impl < ' a , T > Iterator for DoublyIterPtr < ' a , T > {
40+ impl < ' a , T , P > Iterator for DoublyIterPtr < ' a , T , P >
41+ where
42+ P : PinnedVec < Node < Doubly < T > > > ,
43+ {
3444 type Item = NodePtr < Doubly < T > > ;
3545
3646 fn next ( & mut self ) -> Option < Self :: Item > {
@@ -49,7 +59,10 @@ impl<'a, T> Iterator for DoublyIterPtr<'a, T> {
4959 }
5060}
5161
52- impl < ' a , T > DoubleEndedIterator for DoublyIterPtr < ' a , T > {
62+ impl < ' a , T , P > DoubleEndedIterator for DoublyIterPtr < ' a , T , P >
63+ where
64+ P : PinnedVec < Node < Doubly < T > > > ,
65+ {
5366 fn next_back ( & mut self ) -> Option < Self :: Item > {
5467 match & self . current_back {
5568 Some ( p) => {
@@ -67,9 +80,12 @@ impl<'a, T> DoubleEndedIterator for DoublyIterPtr<'a, T> {
6780 }
6881}
6982
70- impl < ' a , T > FusedIterator for DoublyIterPtr < ' a , T > { }
83+ impl < ' a , T , P > FusedIterator for DoublyIterPtr < ' a , T , P > where P : PinnedVec < Node < Doubly < T > > > { }
7184
72- impl < ' a , T > Clone for DoublyIterPtr < ' a , T > {
85+ impl < ' a , T , P > Clone for DoublyIterPtr < ' a , T , P >
86+ where
87+ P : PinnedVec < Node < Doubly < T > > > ,
88+ {
7389 fn clone ( & self ) -> Self {
7490 Self {
7591 col : self . col ,
0 commit comments