mirror of
https://github.com/openharmony/third_party_rust_indexmap.git
synced 2026-07-19 16:43:59 -04:00
impl ExactSizeIterator for Drain
This commit is contained in:
@@ -1098,6 +1098,12 @@ impl<K, V> DoubleEndedIterator for Drain<'_, K, V> {
|
||||
double_ended_iterator_methods!(Bucket::key_value);
|
||||
}
|
||||
|
||||
impl<K, V> ExactSizeIterator for Drain<'_, K, V> {
|
||||
fn len(&self) -> usize {
|
||||
self.iter.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K, V, S> IntoIterator for &'a IndexMap<K, V, S> {
|
||||
type Item = (&'a K, &'a V);
|
||||
type IntoIter = Iter<'a, K, V>;
|
||||
|
||||
@@ -786,6 +786,12 @@ impl<T> DoubleEndedIterator for Drain<'_, T> {
|
||||
double_ended_iterator_methods!(Bucket::key);
|
||||
}
|
||||
|
||||
impl<T> ExactSizeIterator for Drain<'_, T> {
|
||||
fn len(&self) -> usize {
|
||||
self.iter.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T, S> IntoIterator for &'a IndexSet<T, S> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
Reference in New Issue
Block a user