Closed ConsoleTVs closed 1 year ago
Right now, the implementation for the trait IntoIterator for HeaderMap is:
IntoIterator
HeaderMap
impl<T> IntoIterator for HeaderMap<T> { type Item = (Option<HeaderName>, T); type IntoIter = IntoIter<T>; fn into_iter(self) -> IntoIter<T> { ... } }
This does not allow to iterate over (header, value) pairs and is missleading since Both Item and IntoIter types are unused.
(header, value)
Item
IntoIter
I propose to change this implementation to something along those lines:
impl<T> IntoIterator for HeaderMap<T> { type Item = (HeaderName, T); type IntoIter = IntoIter<Self::Item>; fn into_iter(self) -> Self::IntoIter { ... } }
With the changes to this, iterations should be way easier now:
for (header, value) in headers { // header: HeaderName // value: T }
Right now, the implementation for the trait
IntoIterator
forHeaderMap
is:This does not allow to iterate over
(header, value)
pairs and is missleading since BothItem
andIntoIter
types are unused.I propose to change this implementation to something along those lines:
With the changes to this, iterations should be way easier now: