Skip to content
Extraits de code Groupes Projets
Valider be7e7c39 rédigé par Elliu's avatar Elliu
Parcourir les fichiers

UTILS: dkmap: make sure primary and secondary keys are never updated

parent cee49273
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion!205misc debug and harderning, mostly related to repo syncing,!197Draft: Refactor the whole code.
...@@ -59,9 +59,13 @@ where ...@@ -59,9 +59,13 @@ where
/// Note that neither K1 nor K2 will be updated for an already existing mapping, ever /// Note that neither K1 nor K2 will be updated for an already existing mapping, ever
pub fn insert(&mut self, value: (K1, K2, Values)) -> Option<(K1, K2, Values)> { pub fn insert(&mut self, value: (K1, K2, Values)) -> Option<(K1, K2, Values)> {
let (k1, k2, ..) = (value.0, value.1.clone()); let (k1, k2) = (value.0, value.1.clone());
match self.primary_key_mapping.get(&k1) { match self.primary_key_mapping.get(&k1) {
Some(index) => Some(mem::replace(&mut self.values[*index], value)), Some(index) => Some((
k1,
self.values[*index].1.clone(),
mem::replace(&mut self.values[*index].2, value.2),
)),
None => { None => {
self.values.push(value); self.values.push(value);
let index = self.values.len() - 1; let index = self.values.len() - 1;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter