TEMPORARY COMMIT - DO NOT MERGE

This commit is contained in:
Joakim Soderlund 2024-07-17 15:49:34 +02:00
parent f2c09e14a6
commit 9c67b2ce7a

View file

@ -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<T: Read + Seek> Fetcher<T> {
}
pub fn iter(&self) -> impl Iterator<Item = &Story> {
self.index.iter()
self.into_iter()
}
pub fn filter<F>(&self, function: &F) -> Vec<&Story>
@ -116,3 +116,12 @@ impl<T: Read + Seek> Fetcher<T> {
self.index.par_iter().filter(|s| function(s)).collect()
}
}
impl<'a, T: Read + Seek> IntoIterator for &'a Fetcher<T> {
type IntoIter = Iter<'a, Story>;
type Item = &'a Story;
fn into_iter(self) -> Self::IntoIter {
self.index.iter()
}
}