diff --git a/src/read_utils.rs b/src/read_utils.rs index 54befdd21..73fcf67e6 100644 --- a/src/read_utils.rs +++ b/src/read_utils.rs @@ -20,10 +20,10 @@ use crate::{ use failure::{format_err, ResultExt}; use log::info; use serde::Deserialize; -use std::collections::BTreeMap; -use std::fs::File; use std::path; use std::path::{Path, PathBuf}; +use std::{collections::BTreeMap, io::Read}; +use std::{fs::File, io::Seek}; use typed_index_collection::{CollectionWithId, Id}; #[derive(Deserialize, Debug)] @@ -97,7 +97,7 @@ pub(crate) trait FileHandler where Self: std::marker::Sized, { - type Reader: std::io::Read; + type Reader: Read; fn get_file_if_exists(self, name: &str) -> Result<(Option, PathBuf)>; @@ -142,7 +142,7 @@ impl<'a, P: AsRef> FileHandler for &'a mut PathFileHandler

{ /// Unlike ZipArchive, it gives access to a file by its name not regarding its path in the ZipArchive /// It thus cannot be correct if there are 2 files with the same name in the archive, /// but for transport data if will make it possible to handle a zip with a sub directory -pub(crate) struct ZipHandler { +pub(crate) struct ZipHandler { archive: zip::ZipArchive, archive_path: PathBuf, index_by_name: BTreeMap, @@ -150,7 +150,7 @@ pub(crate) struct ZipHandler { impl ZipHandler where - R: std::io::Seek + std::io::Read, + R: Seek + Read, { pub(crate) fn new>(r: R, path: P) -> Result { let mut archive = zip::ZipArchive::new(r)?; @@ -176,7 +176,7 @@ where impl<'a, R> FileHandler for &'a mut ZipHandler where - R: std::io::Seek + std::io::Read, + R: Seek + Read, { type Reader = zip::read::ZipFile<'a>; fn get_file_if_exists(self, name: &str) -> Result<(Option, PathBuf)> {