Hide CandidateMap iterator implementation details

This commit is contained in:
RunasSudo 2022-11-06 14:45:35 +11:00
parent 1a57fba093
commit 631d4e770a
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -84,19 +84,19 @@ impl<'e, V> CandidateMap<'e, V> {
/// See [HashMap::iter](std::collections::HashMap::iter)
#[inline]
pub fn iter(&self) -> Iter<'_, 'e, V> {
pub fn iter<'a>(&'a self) -> impl Iterator<Item=(&'e Candidate, &'a V)> {
return Iter { map: &self, index: 0 };
}
/// See [HashMap::iter_mut](std::collections::HashMap::iter_mut)
#[inline]
pub fn iter_mut(&mut self) -> IterMut<'_, 'e, V> {
pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item=(&'e Candidate, &'a mut V)> {
return IterMut { map: self, index: 0 };
}
/// See [HashMap::values](std::collections::HashMap::values)
#[inline]
pub fn values(&self) -> Values<'_, 'e, V> {
pub fn values<'a>(&'a self) -> impl Iterator<Item=&'a V> {
return Values { map: &self, index: 0 };
}
}
@ -110,7 +110,7 @@ impl<'e, V> Index<&Candidate> for CandidateMap<'e, V> {
}
/// See [CandidateMap::iter]
pub struct Iter<'m, 'e, V> {
struct Iter<'m, 'e, V> {
map: &'m CandidateMap<'e, V>,
index: usize
}
@ -146,7 +146,7 @@ impl<'m, 'e, V> Iterator for Iter<'m, 'e, V> {
}
/// See [CandidateMap::iter_mut]
pub struct IterMut<'m, 'e, V> {
struct IterMut<'m, 'e, V> {
map: &'m mut CandidateMap<'e, V>,
index: usize
}
@ -187,7 +187,7 @@ impl<'m, 'e, V> Iterator for IterMut<'m, 'e, V> {
}
/// See [CandidateMap::values]
pub struct Values<'m, 'e, V> {
struct Values<'m, 'e, V> {
map: &'m CandidateMap<'e, V>,
index: usize
}