pub struct Metadata {
pub data_offset: u64,
pub compressed_size: u64,
pub uncompressed_size: u64,
pub compression_method: CompressionMethod,
pub crc32: u32,
pub file_type: FileType,
pub modification_time: Option<Timestamp>,
pub access_time: Option<Timestamp>,
pub creation_time: Option<Timestamp>,
pub encryption: Option<EncryptionMethod>,
/* private fields */
}Expand description
The metadata of a ZIP entry.
Fields§
§data_offset: u64§compressed_size: u64§uncompressed_size: u64§compression_method: CompressionMethod§crc32: u32§file_type: FileType§modification_time: Option<Timestamp>§access_time: Option<Timestamp>§creation_time: Option<Timestamp>§encryption: Option<EncryptionMethod>Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns true if this file is encrypted.
Sourcepub fn read<R: BufRead + Seek>(&self, reader: R) -> Result<impl Read + use<R>>
pub fn read<R: BufRead + Seek>(&self, reader: R) -> Result<impl Read + use<R>>
Returns a reader with the content of the file.
Unsupported compression methods and encrypted files will return an error.
Sourcepub fn read_stored<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
pub fn read_stored<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
Returns a reader with the content of the file.
Errors if the file is compressed, encrypted or corrupted. Is is not
necessary to use Metadata::content_checker on the result.
It is useful if you know that the file is stored as-is and you want to
take advantage of the BufReader or the Seek implementation.
Sourcepub fn read_raw<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
pub fn read_raw<R: Read + Seek>(&self, reader: R) -> Result<Take<R>>
Returns a reader with the raw, uncompressed, content of the file.
The uncompressed content should be checked with content_checker.
Sourcepub fn content_checker<R: Read>(&self, reader: R) -> impl Read + use<R>
pub fn content_checker<R: Read>(&self, reader: R) -> impl Read + use<R>
Wraps a reader to check that its content matches this metadata.
It is particularly useful in combinaison of read_raw.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more