pub fn common_keys_iter<'a, K, V>(
    a: &'a HashMap<K, V>,
    b: &'a HashMap<K, V>,
) -> CommonKeyIterator<'a, K, V>
where
    K: Hash + Eq,
{
    let is_swaped;

    let (shortest, longest) = if a.len() > b.len() {
        is_swaped = true;
        (b, a)
    } else {
        is_swaped = false;
        (a, b)
    };

    CommonKeyIterator {
        shortest: shortest.iter(),
        longest,
        is_swaped,
    }
}
// Creating a common key iterator is kinda interesting since it'll
// decide which map is going to be iterated based on it's length.
// Basically if one of them is empty, it'll choose it as the main
// iterator, therefore ending the iteration early.
Creating a common key iterator is kinda interesting since it'll
decide which map is going to be iterated based on it's length.
Basically if one of them is empty, it'll choose it as the main
iterator, therefore ending the iteration early.
Creating a common key iterator is kinda interesting since it ' ll decide which map is going to be iterated based on it ' s length . Basically if one of them is empty it ' ll choose it as the main iterator therefore ending the iteration early .
pub fn common_keys_iter<'a, K, V>(
    a: &'a HashMap<K, V>,
    b: &'a HashMap<K, V>,
) -> CommonKeyIterator<'a, K, V>
where
    K: Hash + Eq,
{
    let is_swaped;
    let (shortest, longest) = if a.len() > b.len() {
        is_swaped = true;
        (b, a)
    } else {
        is_swaped = false;
        (a, b)
    };
    CommonKeyIterator {
        shortest: shortest.iter(),
        longest,
        is_swaped,
    }
}
pub fn common_keys_iter < ' a , K , V > ( a : & ' a HashMap < K , V > , b : & ' a HashMap < K , V > , ) -> CommonKeyIterator < ' a , K , V > where K : Hash + Eq , { let is_swaped ; let ( shortest , longest ) = if a . len ( ) > b . len ( ) { is_swaped = true ; ( b , a ) } else { is_swaped = false ; ( a , b ) } ; CommonKeyIterator { shortest : shortest . iter ( ) , longest , is_swaped , } }
Creating a common key iterator is kinda interesting since it'll
decide which map is going to be iterated based on it's length.
Creating a common key iterator is kinda interesting since it ' ll decide which map is going to be iterated based on it ' s length .
a
&'a HashMap<K, V>
b
&'a HashMap<K, V>
a
&'a HashMap<K, V>
b
&'a HashMap<K, V>