mirror of
https://github.com/JockeTF/fimfareader.git
synced 2024-11-30 17:07:59 +01:00
TEMPORARY COMMIT - DO NOT MERGE
This commit is contained in:
parent
f2c09e14a6
commit
9c67b2ce7a
1 changed files with 11 additions and 2 deletions
|
@ -6,10 +6,10 @@ use std::io::ErrorKind as IoErrorKind;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::io::Seek;
|
use std::io::Seek;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::slice::Iter;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
||||||
use zip::read::ZipArchive;
|
use zip::read::ZipArchive;
|
||||||
use zip::result::ZipError;
|
use zip::result::ZipError;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ impl<T: Read + Seek> Fetcher<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> impl Iterator<Item = &Story> {
|
pub fn iter(&self) -> impl Iterator<Item = &Story> {
|
||||||
self.index.iter()
|
self.into_iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn filter<F>(&self, function: &F) -> Vec<&Story>
|
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()
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue