With it one can read entries and read paths at the same time.
Unified · Split
| @@ -132,6 +132,12 @@ impl State { · 131 unmodified lines | |||
| 132 | pub fn entries_mut(&mut self) -> &mut [Entry] { | 132 | pub fn entries_mut(&mut self) -> &mut [Entry] { |
| 133 | &mut self.entries | 133 | &mut self.entries |
| 134 | } | 134 | } |
| 135 | |||
| 136 | /// Return a writable slice to entries and read-access to their path storage at the same time. | ||
| 137 | pub fn entries_mut_and_pathbacking(&mut self) -> (&mut [Entry], &PathStorage) { | ||
| 138 | (&mut self.entries, &self.path_backing) | ||
| 139 | } | ||
| 140 | |||
| 135 | /// Return mutable entries along with their paths in an iterator. | 141 | /// Return mutable entries along with their paths in an iterator. |
| 136 | pub fn entries_mut_with_paths(&mut self) -> impl Iterator<Item = (&mut Entry, &BStr)> { | 142 | pub fn entries_mut_with_paths(&mut self) -> impl Iterator<Item = (&mut Entry, &BStr)> { |
| 137 | let paths = &self.path_backing; | 143 | let paths = &self.path_backing; |
| @@ -93,12 +93,11 @@ pub struct State { · 92 unmodified lines | |||
| 93 | /// same timestamp as this as potentially changed, checking more thoroughly if a change actually happened. | 93 | /// same timestamp as this as potentially changed, checking more thoroughly if a change actually happened. |
| 94 | timestamp: FileTime, | 94 | timestamp: FileTime, |
| 95 | version: Version, | 95 | version: Version, |
| 96 | /// | 96 | entries: Vec<Entry>, |
| 97 | pub entries: Vec<Entry>, | ||
| 98 | /// A memory area keeping all index paths, in full length, independently of the index version. | 97 | /// A memory area keeping all index paths, in full length, independently of the index version. |
| 99 | /// | 98 | /// |
| 100 | /// Ranges into this storage are referred to by parts of `entries`. | 99 | /// Ranges into this storage are referred to by parts of `entries`. |
| 101 | pub path_backing: PathStorage, | 100 | path_backing: PathStorage, |
| 102 | /// True if one entry in the index has a special marker mode | 101 | /// True if one entry in the index has a special marker mode |
| 103 | is_sparse: bool, | 102 | is_sparse: bool, |
| 104 | 103 | ||