Function update_matches

Source
pub fn update_matches(
    (a, b): (Match, Match),
    (where_is_match, matches_hash): (&mut MatchesLookup, &mut Matches),
)
Expand description

Add or remove entries from lookup and matches based on given pair of matches.

There are 4 situations that we prepare for.

  1. The pair of matches both exist in the same bucket. We don’t need to do anything.
  2. The pair of matches both exist in different buckets. We combine both buckets.
  3. One of the pair of matches exist in a bucket. We put the other one in that bucket.
  4. None of the matches exist in any bucket. We put one of them in a bucket labelled with the other.