From 9c67b2ce7a09803bd7bf4d1d3612c68c111403c3 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Wed, 17 Jul 2024 15:49:34 +0200 Subject: [PATCH] TEMPORARY COMMIT - DO NOT MERGE --- src/archive/fetcher.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/archive/fetcher.rs b/src/archive/fetcher.rs index b27a03a..8c460b7 100644 --- a/src/archive/fetcher.rs +++ b/src/archive/fetcher.rs @@ -6,10 +6,10 @@ use std::io::ErrorKind as IoErrorKind; use std::io::Read; use std::io::Seek; use std::path::Path; +use std::slice::Iter; use std::sync::Mutex; use rayon::prelude::*; - use zip::read::ZipArchive; use zip::result::ZipError; @@ -106,7 +106,7 @@ impl Fetcher { } pub fn iter(&self) -> impl Iterator { - self.index.iter() + self.into_iter() } pub fn filter(&self, function: &F) -> Vec<&Story> @@ -116,3 +116,12 @@ impl Fetcher { self.index.par_iter().filter(|s| function(s)).collect() } } + +impl<'a, T: Read + Seek> IntoIterator for &'a Fetcher { + type IntoIter = Iter<'a, Story>; + type Item = &'a Story; + + fn into_iter(self) -> Self::IntoIter { + self.index.iter() + } +}