Try to get the next hash from the current file iterator.
(&mut self)
| 37 | |
| 38 | /// Try to get the next hash from the current file iterator. |
| 39 | fn next_from_files(&mut self) -> Option<ChangeStoreResult<Hash>> { |
| 40 | let file_iter = self.file_iter.as_mut()?; |
| 41 | |
| 42 | for entry_result in file_iter { |
| 43 | match entry_result { |
| 44 | Ok(entry) => { |
| 45 | let path = entry.path(); |
| 46 | |
| 47 | // Skip if not a file |
| 48 | if !path.is_file() { |
| 49 | continue; |
| 50 | } |
| 51 | |
| 52 | // Check for .change extension |
| 53 | if path.extension().is_none_or(|e| e != CHANGE_EXTENSION) { |
| 54 | continue; |
| 55 | } |
| 56 | |
| 57 | // Extract the hash from the filename |
| 58 | if let Some(hash) = Self::hash_from_path(&path) { |
| 59 | return Some(Ok(hash)); |
| 60 | } |
| 61 | } |
| 62 | Err(e) => return Some(Err(ChangeStoreError::Io(e))), |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | None |
| 67 | } |
| 68 | |
| 69 | /// Extract a hash from a change file path. |
| 70 | fn hash_from_path(path: &Path) -> Option<Hash> { |