@@ -13,15 +13,15 @@ pub struct Platform<'r> {
13
13
}
14
14
15
15
/// An iterator over references, with or without filter.
16
- pub struct Iter < ' r > {
17
- inner : gix_ref:: file:: iter:: LooseThenPacked < ' r , ' r > ,
16
+ pub struct Iter < ' packed , ' repo > {
17
+ inner : gix_ref:: file:: iter:: LooseThenPacked < ' packed , ' repo > ,
18
18
peel_with_packed : Option < gix_ref:: file:: packed:: SharedBufferSnapshot > ,
19
19
peel : bool ,
20
- repo : & ' r crate :: Repository ,
20
+ repo : & ' repo crate :: Repository ,
21
21
}
22
22
23
- impl < ' r > Iter < ' r > {
24
- fn new ( repo : & ' r crate :: Repository , platform : gix_ref:: file:: iter:: LooseThenPacked < ' r , ' r > ) -> Self {
23
+ impl < ' packed , ' repo > Iter < ' packed , ' repo > {
24
+ fn new ( repo : & ' repo crate :: Repository , platform : gix_ref:: file:: iter:: LooseThenPacked < ' packed , ' repo > ) -> Self {
25
25
Iter {
26
26
inner : platform,
27
27
peel_with_packed : None ,
@@ -31,13 +31,13 @@ impl<'r> Iter<'r> {
31
31
}
32
32
}
33
33
34
- impl Platform < ' _ > {
34
+ impl < ' repo > Platform < ' repo > {
35
35
/// Return an iterator over all references in the repository, excluding
36
36
/// pseudo references.
37
37
///
38
38
/// Even broken or otherwise unparsable or inaccessible references are returned and have to be handled by the caller on a
39
39
/// case by case basis.
40
- pub fn all ( & self ) -> Result < Iter < ' _ > , init:: Error > {
40
+ pub fn all ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
41
41
Ok ( Iter :: new ( self . repo , self . platform . all ( ) ?) )
42
42
}
43
43
@@ -47,23 +47,22 @@ impl Platform<'_> {
47
47
pub fn prefixed < ' a > (
48
48
& self ,
49
49
prefix : impl TryInto < & ' a RelativePath , Error = gix_path:: relative_path:: Error > ,
50
- ) -> Result < Iter < ' _ > , init:: Error > {
50
+ ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
51
51
Ok ( Iter :: new ( self . repo , self . platform . prefixed ( prefix. try_into ( ) ?) ?) )
52
52
}
53
53
54
- // TODO: tests
55
54
/// Return an iterator over all references that are tags.
56
55
///
57
56
/// They are all prefixed with `refs/tags`.
58
- pub fn tags ( & self ) -> Result < Iter < ' _ > , init:: Error > {
57
+ pub fn tags ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
59
58
Ok ( Iter :: new ( self . repo , self . platform . prefixed ( b"refs/tags/" . try_into ( ) ?) ?) )
60
59
}
61
60
62
61
// TODO: tests
63
62
/// Return an iterator over all local branches.
64
63
///
65
64
/// They are all prefixed with `refs/heads`.
66
- pub fn local_branches ( & self ) -> Result < Iter < ' _ > , init:: Error > {
65
+ pub fn local_branches ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
67
66
Ok ( Iter :: new (
68
67
self . repo ,
69
68
self . platform . prefixed ( b"refs/heads/" . try_into ( ) ?) ?,
@@ -72,23 +71,23 @@ impl Platform<'_> {
72
71
73
72
// TODO: tests
74
73
/// Return an iterator over all local pseudo references.
75
- pub fn pseudo ( & self ) -> Result < Iter < ' _ > , init:: Error > {
74
+ pub fn pseudo ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
76
75
Ok ( Iter :: new ( self . repo , self . platform . pseudo ( ) ?) )
77
76
}
78
77
79
78
// TODO: tests
80
79
/// Return an iterator over all remote branches.
81
80
///
82
81
/// They are all prefixed with `refs/remotes`.
83
- pub fn remote_branches ( & self ) -> Result < Iter < ' _ > , init:: Error > {
82
+ pub fn remote_branches ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
84
83
Ok ( Iter :: new (
85
84
self . repo ,
86
85
self . platform . prefixed ( b"refs/remotes/" . try_into ( ) ?) ?,
87
86
) )
88
87
}
89
88
}
90
89
91
- impl Iter < ' _ > {
90
+ impl Iter < ' _ , ' _ > {
92
91
/// Automatically peel references before yielding them during iteration.
93
92
///
94
93
/// This has the same effect as using `iter.map(|r| {r.peel_to_id_in_place(); r})`.
@@ -104,7 +103,7 @@ impl Iter<'_> {
104
103
}
105
104
}
106
105
107
- impl < ' r > Iterator for Iter < ' r > {
106
+ impl < ' r > Iterator for Iter < ' _ , ' r > {
108
107
type Item = Result < crate :: Reference < ' r > , Box < dyn std:: error:: Error + Send + Sync + ' static > > ;
109
108
110
109
fn next ( & mut self ) -> Option < Self :: Item > {
0 commit comments