As-is on the tin, mirrors the recently-stabilized `min_by_key` and `max_by_key` methods on `Iterator`.