@@ -13,15 +13,15 @@ pub struct Platform<'r> {
1313}
1414
1515/// An iterator over references, with or without filter.
16- pub struct Iter < ' p , ' r > {
17- inner : gix_ref:: file:: iter:: LooseThenPacked < ' p , ' r > ,
16+ pub struct Iter < ' packed , ' repo > {
17+ inner : gix_ref:: file:: iter:: LooseThenPacked < ' packed , ' repo > ,
1818 peel_with_packed : Option < gix_ref:: file:: packed:: SharedBufferSnapshot > ,
1919 peel : bool ,
20- repo : & ' r crate :: Repository ,
20+ repo : & ' repo crate :: Repository ,
2121}
2222
23- impl < ' p , ' r > Iter < ' p , ' r > {
24- fn new ( repo : & ' r crate :: Repository , platform : gix_ref:: file:: iter:: LooseThenPacked < ' p , ' 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 {
2525 Iter {
2626 inner : platform,
2727 peel_with_packed : None ,
@@ -37,49 +37,32 @@ impl<'repo> Platform<'repo> {
3737 ///
3838 /// Even broken or otherwise unparsable or inaccessible references are returned and have to be handled by the caller on a
3939 /// case by case basis.
40- pub fn all < ' p > ( & ' p self ) -> Result < Iter < ' p , ' repo > , init:: Error > {
40+ pub fn all ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
4141 Ok ( Iter :: new ( self . repo , self . platform . all ( ) ?) )
4242 }
4343
4444 /// Return an iterator over all references that match the given `prefix`.
4545 ///
4646 /// These are of the form `refs/heads/` or `refs/remotes/origin`, and must not contain relative paths components like `.` or `..`.
47- pub fn prefixed < ' p , ' a > (
48- & ' p self ,
47+ pub fn prefixed < ' a > (
48+ & self ,
4949 prefix : impl TryInto < & ' a RelativePath , Error = gix_path:: relative_path:: Error > ,
50- ) -> Result < Iter < ' p , ' repo > , init:: Error > {
50+ ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
5151 Ok ( Iter :: new ( self . repo , self . platform . prefixed ( prefix. try_into ( ) ?) ?) )
5252 }
5353
54- // TODO: tests
5554 /// Return an iterator over all references that are tags.
5655 ///
5756 /// They are all prefixed with `refs/tags`.
58- ///
59- /// ```rust
60- /// # // Regression test for https://github.com/GitoxideLabs/gitoxide/issues/2103
61- /// # // This only ensures we can return a reference, not that the code below is correct
62- /// /// Get the latest tag that isn't a pre-release version
63- /// fn latest_stable_tag(repo: &gix::Repository) -> Result<gix::Reference<'_>, Box<dyn std::error::Error>> {
64- /// repo.references()?
65- /// .tags()?
66- /// .filter_map(|tag| tag.ok())
67- /// // Warning: lexically sorting version numbers is incorrect, use the semver crate if
68- /// // you want correct results
69- /// .max_by_key(|tag| tag.name().shorten().to_owned())
70- /// .ok_or(std::io::Error::other("latest tag not found"))
71- /// .map_err(Into::into)
72- /// }
73- /// ```
74- pub fn tags < ' p > ( & ' p self ) -> Result < Iter < ' p , ' repo > , init:: Error > {
57+ pub fn tags ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
7558 Ok ( Iter :: new ( self . repo , self . platform . prefixed ( b"refs/tags/" . try_into ( ) ?) ?) )
7659 }
7760
7861 // TODO: tests
7962 /// Return an iterator over all local branches.
8063 ///
8164 /// They are all prefixed with `refs/heads`.
82- pub fn local_branches < ' p > ( & ' p self ) -> Result < Iter < ' p , ' repo > , init:: Error > {
65+ pub fn local_branches ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
8366 Ok ( Iter :: new (
8467 self . repo ,
8568 self . platform . prefixed ( b"refs/heads/" . try_into ( ) ?) ?,
@@ -88,15 +71,15 @@ impl<'repo> Platform<'repo> {
8871
8972 // TODO: tests
9073 /// Return an iterator over all local pseudo references.
91- pub fn pseudo < ' p > ( & ' p self ) -> Result < Iter < ' p , ' repo > , init:: Error > {
74+ pub fn pseudo ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
9275 Ok ( Iter :: new ( self . repo , self . platform . pseudo ( ) ?) )
9376 }
9477
9578 // TODO: tests
9679 /// Return an iterator over all remote branches.
9780 ///
9881 /// They are all prefixed with `refs/remotes`.
99- pub fn remote_branches < ' p > ( & ' p self ) -> Result < Iter < ' p , ' repo > , init:: Error > {
82+ pub fn remote_branches ( & self ) -> Result < Iter < ' _ , ' repo > , init:: Error > {
10083 Ok ( Iter :: new (
10184 self . repo ,
10285 self . platform . prefixed ( b"refs/remotes/" . try_into ( ) ?) ?,
0 commit comments