From dcd15d10bbe78808aa0f07148ac915ba26a97351 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 1 Mar 2019 13:29:19 +0100 Subject: [PATCH] backup/index: remove IndexIterator removed the need for it, to avoid copies Signed-off-by: Wolfgang Bumiller --- src/backup/index.rs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/src/backup/index.rs b/src/backup/index.rs index 1cad4e69..80501287 100644 --- a/src/backup/index.rs +++ b/src/backup/index.rs @@ -2,43 +2,3 @@ pub trait IndexFile { fn index_count(&self) -> usize; fn index_digest(&self, pos: usize) -> Option<&[u8; 32]>; } - -pub struct IndexIterator { - pos: usize, - count: usize, - reader: Box, -} - -impl Iterator for IndexIterator { - type Item = [u8; 32]; - - fn next(&mut self) -> Option { - if self.pos == self.count { - return None; - } - - let digest = self.reader.index_digest(self.pos).unwrap(); - self.pos += 1; - Some(*digest) - } -} - -impl From> for IndexIterator { - fn from(file: Box) -> Self { - Self { - pos: 0, - count: file.index_count(), - reader: file, - } - } -} - -impl From> for IndexIterator { - fn from(file: Box) -> Self { - Self { - pos: 0, - count: file.index_count(), - reader: file, - } - } -}