diff options
Diffstat (limited to 'src/zip/archive.rs')
| -rw-r--r-- | src/zip/archive.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/zip/archive.rs b/src/zip/archive.rs index 79e8ca1..569ad87 100644 --- a/src/zip/archive.rs +++ b/src/zip/archive.rs | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | use crate::zip::{ZipFileReader, ZipResult}; | ||
| 1 | use crate::{Archive, Zip}; | 2 | use crate::{Archive, Zip}; |
| 2 | use std::io::{Read, Seek, Write}; | 3 | use std::io::{Read, Seek, Write}; |
| 3 | 4 | ||
| @@ -5,6 +6,24 @@ impl<Io: Read + Seek> Archive<Zip<Io>> { | |||
| 5 | pub fn comment(&self) -> &String { | 6 | pub fn comment(&self) -> &String { |
| 6 | self.driver.comment() | 7 | self.driver.comment() |
| 7 | } | 8 | } |
| 9 | |||
| 10 | pub fn get_file_reader_by_index_with_password<'d>( | ||
| 11 | &'d mut self, | ||
| 12 | index: usize, | ||
| 13 | password: &[u8], | ||
| 14 | ) -> ZipResult<ZipFileReader<'d, Io>> { | ||
| 15 | self.driver | ||
| 16 | .get_file_reader_with_optional_password(index, Some(password)) | ||
| 17 | } | ||
| 18 | |||
| 19 | #[inline] | ||
| 20 | pub fn get_file_reader_by_name_with_password<'d>( | ||
| 21 | &'d mut self, | ||
| 22 | name: &str, | ||
| 23 | password: &[u8], | ||
| 24 | ) -> ZipResult<ZipFileReader<'d, Io>> { | ||
| 25 | self.get_file_reader_by_index_with_password(self.get_file_index(name)?, password) | ||
| 26 | } | ||
| 8 | } | 27 | } |
| 9 | 28 | ||
| 10 | impl<Io: Read + Write + Seek> Archive<Zip<Io>> {} | 29 | impl<Io: Read + Write + Seek> Archive<Zip<Io>> {} |
