@@ -22,47 +22,47 @@ pub struct IterDescending;
2222/// respectively.
2323#[ derive( Debug ) ]
2424#[ must_use = "iterators are lazy and do nothing unless consumed" ]
25- pub struct TrieEdgeIter < ' a , N : ? Sized , V : ?Sized , D > {
25+ pub struct TrieEdgeIter < ' root , N , V : ?Sized , D > {
2626 leading_path : PathBuf ,
27- stack : Vec < Frame < ' a , N , V > > ,
27+ stack : Vec < Frame < ' root , N , V > > ,
2828 marker : std:: marker:: PhantomData < D > ,
2929}
3030
3131/// An iterator over the key-value pairs in a key-value trie.
3232#[ derive( Debug ) ]
3333#[ must_use = "iterators are lazy and do nothing unless consumed" ]
34- pub struct TrieValueIter < ' a , N : ? Sized , V : ?Sized , D > {
35- edges : TrieEdgeIter < ' a , N , V , D > ,
34+ pub struct TrieValueIter < ' root , N , V : ?Sized , D > {
35+ edges : TrieEdgeIter < ' root , N , V , D > ,
3636}
3737
3838/// An iterator over the edges along a specified path in a key-value trie
3939/// terminating at the node corresponding to the path, if it exists; otherwise,
4040/// terminating at the deepest existing edge along the path.
4141#[ derive( Debug ) ]
4242#[ must_use = "iterators are lazy and do nothing unless consumed" ]
43- pub struct TriePathIter < ' a , P , N : ? Sized , V : ?Sized > {
43+ pub struct TriePathIter < ' root , P , N , V : ?Sized > {
4444 needle : P ,
4545 current_path : PathBuf ,
46- current_edge : Option < TrieEdgeState < ' a , N > > ,
46+ current_edge : Option < TrieEdgeState < ' root , N > > ,
4747 marker : std:: marker:: PhantomData < V > ,
4848}
4949
5050#[ derive( Debug ) ]
51- struct Frame < ' a , N : ? Sized , V : ?Sized > {
52- node : & ' a N ,
53- hash : Option < & ' a HashType > ,
51+ struct Frame < ' root , N , V : ?Sized > {
52+ node : N ,
53+ hash : Option < & ' root HashType > ,
5454 leading_path_len : usize ,
5555 children : Option < std:: array:: IntoIter < PathComponent , { PathComponent :: LEN } > > ,
5656 marker : std:: marker:: PhantomData < V > ,
5757}
5858
59- impl < ' a , N , V , D > TrieEdgeIter < ' a , N , V , D >
59+ impl < ' root , N , V , D > TrieEdgeIter < ' root , N , V , D >
6060where
61- N : TrieNode < V > + ? Sized ,
62- V : AsRef < [ u8 ] > + ?Sized ,
61+ N : TrieNode < ' root , V > ,
62+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
6363{
6464 /// Creates a new iterator over the given key-value trie.
65- pub fn new ( root : & ' a N , root_hash : Option < & ' a HashType > ) -> Self {
65+ pub fn new ( root : N , root_hash : Option < & ' root HashType > ) -> Self {
6666 let mut this = Self {
6767 leading_path : PathBuf :: new_const ( ) ,
6868 stack : Vec :: new ( ) ,
@@ -74,15 +74,15 @@ where
7474
7575 /// Transforms this iterator into an iterator over the key-value pairs in
7676 /// the trie.
77- pub const fn node_values ( self ) -> TrieValueIter < ' a , N , V , D > {
77+ pub const fn node_values ( self ) -> TrieValueIter < ' root , N , V , D > {
7878 TrieValueIter { edges : self }
7979 }
8080
8181 fn push_frame (
8282 & mut self ,
8383 leading_component : Option < PathComponent > ,
84- node : & ' a N ,
85- hash : Option < & ' a HashType > ,
84+ node : N ,
85+ hash : Option < & ' root HashType > ,
8686 ) {
8787 let frame = Frame {
8888 node,
@@ -97,15 +97,15 @@ where
9797 }
9898}
9999
100- impl < ' a , P , N , V > TriePathIter < ' a , P , N , V >
100+ impl < ' root , P , N , V > TriePathIter < ' root , P , N , V >
101101where
102102 P : SplitPath ,
103- N : TrieNode < V > + ? Sized ,
104- V : AsRef < [ u8 ] > + ?Sized ,
103+ N : TrieNode < ' root , V > ,
104+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
105105{
106106 /// Creates a new iterator over the edges along the given path in the
107107 /// specified key-value trie.
108- pub const fn new ( root : & ' a N , root_hash : Option < & ' a HashType > , path : P ) -> Self {
108+ pub const fn new ( root : N , root_hash : Option < & ' root HashType > , path : P ) -> Self {
109109 let mut this = Self {
110110 needle : path,
111111 current_path : PathBuf :: new_const ( ) ,
@@ -149,12 +149,12 @@ macro_rules! descend {
149149 } ;
150150}
151151
152- impl < ' a , N , V > Iterator for TrieEdgeIter < ' a , N , V , IterAscending >
152+ impl < ' root , N , V > Iterator for TrieEdgeIter < ' root , N , V , IterAscending >
153153where
154- N : TrieNode < V > + ? Sized ,
155- V : AsRef < [ u8 ] > + ?Sized ,
154+ N : TrieNode < ' root , V > ,
155+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
156156{
157- type Item = ( PathBuf , TrieEdgeState < ' a , N > ) ;
157+ type Item = ( PathBuf , TrieEdgeState < ' root , N > ) ;
158158
159159 fn next ( & mut self ) -> Option < Self :: Item > {
160160 while let Some ( & mut Frame {
@@ -191,12 +191,12 @@ where
191191 }
192192}
193193
194- impl < ' a , N , V > Iterator for TrieEdgeIter < ' a , N , V , IterDescending >
194+ impl < ' root , N , V > Iterator for TrieEdgeIter < ' root , N , V , IterDescending >
195195where
196- N : TrieNode < V > + ? Sized ,
197- V : AsRef < [ u8 ] > + ?Sized ,
196+ N : TrieNode < ' root , V > ,
197+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
198198{
199- type Item = ( PathBuf , TrieEdgeState < ' a , N > ) ;
199+ type Item = ( PathBuf , TrieEdgeState < ' root , N > ) ;
200200
201201 fn next ( & mut self ) -> Option < Self :: Item > {
202202 while let Some ( & mut Frame {
@@ -226,39 +226,39 @@ where
226226 }
227227}
228228
229- impl < ' a , N , V > Iterator for TrieValueIter < ' a , N , V , IterAscending >
229+ impl < ' root , N , V > Iterator for TrieValueIter < ' root , N , V , IterAscending >
230230where
231- N : TrieNode < V > + ? Sized ,
232- V : AsRef < [ u8 ] > + ?Sized + ' a ,
231+ N : TrieNode < ' root , V > ,
232+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
233233{
234- type Item = ( PathBuf , & ' a V ) ;
234+ type Item = ( PathBuf , & ' root V ) ;
235235
236236 fn next ( & mut self ) -> Option < Self :: Item > {
237237 self . edges
238238 . find_map ( |( path, node) | node. value ( ) . map ( |v| ( path, v) ) )
239239 }
240240}
241241
242- impl < ' a , N , V > Iterator for TrieValueIter < ' a , N , V , IterDescending >
242+ impl < ' root , N , V > Iterator for TrieValueIter < ' root , N , V , IterDescending >
243243where
244- N : TrieNode < V > + ? Sized ,
245- V : AsRef < [ u8 ] > + ?Sized + ' a ,
244+ N : TrieNode < ' root , V > ,
245+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
246246{
247- type Item = ( PathBuf , & ' a V ) ;
247+ type Item = ( PathBuf , & ' root V ) ;
248248
249249 fn next ( & mut self ) -> Option < Self :: Item > {
250250 self . edges
251251 . find_map ( |( path, node) | node. value ( ) . map ( |v| ( path, v) ) )
252252 }
253253}
254254
255- impl < ' a , P , N , V > Iterator for TriePathIter < ' a , P , N , V >
255+ impl < ' root , P , N , V > Iterator for TriePathIter < ' root , P , N , V >
256256where
257257 P : SplitPath ,
258- N : TrieNode < V > + ? Sized ,
259- V : AsRef < [ u8 ] > + ?Sized ,
258+ N : TrieNode < ' root , V > ,
259+ V : AsRef < [ u8 ] > + ?Sized + ' root ,
260260{
261- type Item = ( PathBuf , TrieEdgeState < ' a , N > ) ;
261+ type Item = ( PathBuf , TrieEdgeState < ' root , N > ) ;
262262
263263 fn next ( & mut self ) -> Option < Self :: Item > {
264264 // qualified path to `Option::take` because rust-analyzer thinks
@@ -293,7 +293,7 @@ where
293293
294294// auto-derived implementations would require N: Clone, V: Clone which is too much
295295
296- impl < N : ? Sized , V : ?Sized , D > Clone for TrieEdgeIter < ' _ , N , V , D > {
296+ impl < N : Copy , V : ?Sized , D > Clone for TrieEdgeIter < ' _ , N , V , D > {
297297 fn clone ( & self ) -> Self {
298298 Self {
299299 leading_path : self . leading_path . clone ( ) ,
@@ -308,7 +308,7 @@ impl<N: ?Sized, V: ?Sized, D> Clone for TrieEdgeIter<'_, N, V, D> {
308308 }
309309}
310310
311- impl < N : ? Sized , V : ?Sized , D > Clone for TrieValueIter < ' _ , N , V , D > {
311+ impl < N : Copy , V : ?Sized , D > Clone for TrieValueIter < ' _ , N , V , D > {
312312 fn clone ( & self ) -> Self {
313313 Self {
314314 edges : self . edges . clone ( ) ,
@@ -320,7 +320,7 @@ impl<N: ?Sized, V: ?Sized, D> Clone for TrieValueIter<'_, N, V, D> {
320320 }
321321}
322322
323- impl < P : SplitPath , N : ? Sized , V : ?Sized > Clone for TriePathIter < ' _ , P , N , V > {
323+ impl < P : Copy , N : Copy , V : ?Sized > Clone for TriePathIter < ' _ , P , N , V > {
324324 fn clone ( & self ) -> Self {
325325 Self {
326326 needle : self . needle ,
@@ -337,7 +337,7 @@ impl<P: SplitPath, N: ?Sized, V: ?Sized> Clone for TriePathIter<'_, P, N, V> {
337337 }
338338}
339339
340- impl < N : ? Sized , V : ?Sized > Clone for Frame < ' _ , N , V > {
340+ impl < N : Copy , V : ?Sized > Clone for Frame < ' _ , N , V > {
341341 fn clone ( & self ) -> Self {
342342 Self {
343343 node : self . node ,
0 commit comments