aboutsummaryrefslogtreecommitdiff
path: root/src/zip/archive.rs
blob: 569ad8778a4faf5ad3a1b1f09850f5a30723de8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::zip::{ZipFileReader, ZipResult};
use crate::{Archive, Zip};
use std::io::{Read, Seek, Write};

impl<Io: Read + Seek> Archive<Zip<Io>> {
    pub fn comment(&self) -> &String {
        self.driver.comment()
    }

    pub fn get_file_reader_by_index_with_password<'d>(
        &'d mut self,
        index: usize,
        password: &[u8],
    ) -> ZipResult<ZipFileReader<'d, Io>> {
        self.driver
            .get_file_reader_with_optional_password(index, Some(password))
    }

    #[inline]
    pub fn get_file_reader_by_name_with_password<'d>(
        &'d mut self,
        name: &str,
        password: &[u8],
    ) -> ZipResult<ZipFileReader<'d, Io>> {
        self.get_file_reader_by_index_with_password(self.get_file_index(name)?, password)
    }
}

impl<Io: Read + Write + Seek> Archive<Zip<Io>> {}