async_zip/file/
mod.rs

1// Copyright (c) 2022 Harry [Majored] [hello@majored.pw]
2// MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE)
3
4pub(crate) mod builder;
5
6use crate::{entry::StoredZipEntry, string::ZipString};
7use builder::ZipFileBuilder;
8
9/// An immutable store of data about a ZIP file.
10#[derive(Clone)]
11pub struct ZipFile {
12    pub(crate) entries: Vec<StoredZipEntry>,
13    pub(crate) zip64: bool,
14    pub(crate) comment: ZipString,
15}
16
17impl From<ZipFileBuilder> for ZipFile {
18    fn from(builder: ZipFileBuilder) -> Self {
19        builder.0
20    }
21}
22
23impl ZipFile {
24    /// Returns a list of this ZIP file's entries.
25    pub fn entries(&self) -> &[StoredZipEntry] {
26        &self.entries
27    }
28
29    /// Returns this ZIP file's trailing comment.
30    pub fn comment(&self) -> &ZipString {
31        &self.comment
32    }
33
34    /// Returns whether or not this ZIP file is zip64
35    pub fn zip64(&self) -> bool {
36        self.zip64
37    }
38}