pub fn merge_responses(
    responses: impl IntoIterator<Item = proto::GetWriteInfoResponse>,
) -> proto::GetWriteInfoResponse {
    // Map kafka partition id to status
    let mut partition_infos: HashMap<_, proto::KafkaPartitionInfo> = HashMap::new();

    responses
        .into_iter()
        .flat_map(|res| res.kafka_partition_infos.into_iter())
        .for_each(|info| {
            partition_infos
                .entry(info.kafka_partition_id)
                .and_modify(|existing_info| existing_info.merge(&info))
                .or_insert(info);
        });

    let kafka_partition_infos = partition_infos
        .into_iter()
        .map(|(_kafka_partition_id, info)| info)
        .collect();

    proto::GetWriteInfoResponse {
        kafka_partition_infos,
    }
}
/// "Merges" the partition information for write info responses so that the "most recent"
/// information is returned.
"Merges" the partition information for write info responses so that the "most recent"
information is returned.
" Merges " the partition information for write info responses so that the " most recent " information is returned .
pub fn merge_responses(
    responses: impl IntoIterator<Item = proto::GetWriteInfoResponse>,
) -> proto::GetWriteInfoResponse {
    // Map kafka partition id to status
    let mut partition_infos: HashMap<_, proto::KafkaPartitionInfo> = HashMap::new();
    responses
        .into_iter()
        .flat_map(|res| res.kafka_partition_infos.into_iter())
        .for_each(|info| {
            partition_infos
                .entry(info.kafka_partition_id)
                .and_modify(|existing_info| existing_info.merge(&info))
                .or_insert(info);
        });
    let kafka_partition_infos = partition_infos
        .into_iter()
        .map(|(_kafka_partition_id, info)| info)
        .collect();
    proto::GetWriteInfoResponse {
        kafka_partition_infos,
    }
}
pub fn merge_responses ( responses : impl IntoIterator < Item = proto :: GetWriteInfoResponse > , ) -> proto :: GetWriteInfoResponse { // Map kafka partition id to status let mut partition_infos : HashMap < _ , proto :: KafkaPartitionInfo > = HashMap :: new ( ) ; responses . into_iter ( ) . flat_map ( | res | res . kafka_partition_infos . into_iter ( ) ) . for_each ( | info | { partition_infos . entry ( info . kafka_partition_id ) . and_modify ( | existing_info | existing_info . merge ( & info ) ) . or_insert ( info ) ; } ) ; let kafka_partition_infos = partition_infos . into_iter ( ) . map ( | ( _kafka_partition_id , info ) | info ) . collect ( ) ; proto :: GetWriteInfoResponse { kafka_partition_infos , } }
"Merges" the partition information for write info responses so that the "most recent"
information is returned.
" Merges " the partition information for write info responses so that the " most recent " information is returned .
responses
impl IntoIterator<Item = proto::GetWriteInfoResponse>
responses
impl IntoIterator<Item = proto::GetWriteInfoResponse>