pub fn merge_with_partitions<T>(
    mut existing: collections::HashMap<
        <T as GetTable>::Partition,
        collections::BTreeMap<T::PrimaryKey, T>,
    >,
    data: &[T],
) -> collections::HashMap<<T as GetTable>::Partition, collections::BTreeMap<T::PrimaryKey, T>>
where
    T: serde::Serialize + Send + GetTable + CompareWithRow<Row = T> + fmt::Debug,
{
    for row in data {
        let partition = row.partition_suffix();
        let pk = row.primary_key();
        if let Some(entry) = existing.get_mut(&partition) {
            entry.entry(pk).or_insert_with(|| row.clone());
        } else {
            existing.insert(partition, iter::once((pk, row.clone())).collect());
        }
    }

    existing
}
// in memory
// the input map is all
in memory
the input map is all
in memory the input map is all
pub fn merge_with_partitions<T>(
    mut existing: collections::HashMap<
        <T as GetTable>::Partition,
        collections::BTreeMap<T::PrimaryKey, T>,
    >,
    data: &[T],
) -> collections::HashMap<<T as GetTable>::Partition, collections::BTreeMap<T::PrimaryKey, T>>
where
    T: serde::Serialize + Send + GetTable + CompareWithRow<Row = T> + fmt::Debug,
{
    for row in data {
        let partition = row.partition_suffix();
        let pk = row.primary_key();
        if let Some(entry) = existing.get_mut(&partition) {
            entry.entry(pk).or_insert_with(|| row.clone());
        } else {
            existing.insert(partition, iter::once((pk, row.clone())).collect());
        }
    }
    existing
}
pub fn merge_with_partitions < T > ( mut existing : collections :: HashMap < < T as GetTable > :: Partition , collections :: BTreeMap < T :: PrimaryKey , T > , > , data : & [ T ] , ) -> collections :: HashMap < < T as GetTable > :: Partition , collections :: BTreeMap < T :: PrimaryKey , T > > where T : serde :: Serialize + Send + GetTable + CompareWithRow < Row = T > + fmt :: Debug , { for row in data { let partition = row . partition_suffix ( ) ; let pk = row . primary_key ( ) ; if let Some ( entry ) = existing . get_mut ( & partition ) { entry . entry ( pk ) . or_insert_with ( | | row . clone ( ) ) ; } else { existing . insert ( partition , iter :: once ( ( pk , row . clone ( ) ) ) . collect ( ) ) ; } } existing }
in memory
the input map is all
in memory the input map is all
existing
collections::HashMap<
        <T as GetTable>::Partition,
        collections::BTreeMap<T::PrimaryKey, T>,
    >
data
&[T]
existing
collections::HashMap<
        <T as GetTable>::Partition,
        collections::BTreeMap<T::PrimaryKey, T>,
    >
data
&[T]