pub(crate) fn merge_by_index<T>(parts: Vec<Vec<(usize, T)>>) -> Vec<(usize, T)> {
    let total_len: usize = parts.iter().map(Vec::len).sum();
    let iterators = parts
        .into_iter()
        .map(|part| part.into_iter().peekable())
        .collect();
    let merging_iter = MergingIter {
        iterators,
        total_len,
    };
    merging_iter.collect()
}
Merges several vectors of items into a single vector, where each original vector
and the resulting vector are ordered by the item index (the first element of the tuple
in the original vectors).

# Return value

Returns the merged values, each accompanied with a 0-based index of the original part
where the value is coming from.
core/lib/merkle_tree/src/utils.rs