diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 48416:c1b633db67fc

rust: Serializing a DirstateMap does not mutate it anymore Differential Revision: https://phab.mercurial-scm.org/D11834
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 29 Nov 2021 17:37:08 +0100
parents 434de12918fd
children 2097f63575a5
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Fri Nov 26 15:07:59 2021 +0100
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Mon Nov 29 17:37:08 2021 +0100
@@ -909,10 +909,10 @@
 
     #[timed]
     pub fn pack_v1(
-        &mut self,
+        &self,
         parents: DirstateParents,
     ) -> Result<Vec<u8>, DirstateError> {
-        let map = self.get_map_mut();
+        let map = self.get_map();
         // Optizimation (to be measured?): pre-compute size to avoid `Vec`
         // reallocations
         let mut size = parents.as_bytes().len();
@@ -949,10 +949,10 @@
     /// (false).
     #[timed]
     pub fn pack_v2(
-        &mut self,
+        &self,
         can_append: bool,
     ) -> Result<(Vec<u8>, Vec<u8>, bool), DirstateError> {
-        let map = self.get_map_mut();
+        let map = self.get_map();
         on_disk::write(map, can_append)
     }