ZipFileEntry

Struct ZipFileEntry 

Source
pub struct ZipFileEntry {
    pub file_name: String,
    pub compression_method: CompressionMethod,
    pub compressed_size: u64,
    pub uncompressed_size: u64,
    pub crc32: u32,
    pub lfh_offset: u64,
    pub last_mod_time: u16,
    pub last_mod_date: u16,
    pub is_directory: bool,
}
Expand description

Parsed ZIP file entry information.

This structure contains all the metadata needed to extract a file from a ZIP archive, parsed from the Central Directory.

§Example

for entry in extractor.list_files().await? {
    println!("{}: {} bytes (compressed: {})",
        entry.file_name,
        entry.uncompressed_size,
        entry.compressed_size
    );
}

Fields§

§file_name: String

The file name (may include path components)

§compression_method: CompressionMethod

Compression method used for this entry

§compressed_size: u64

Size of compressed data in bytes

§uncompressed_size: u64

Size of uncompressed data in bytes

§crc32: u32

CRC-32 checksum of uncompressed data

§lfh_offset: u64

Offset to Local File Header from start of archive

§last_mod_time: u16

Last modification time in DOS format

§last_mod_date: u16

Last modification date in DOS format

§is_directory: bool

True if this entry represents a directory

Implementations§

Source§

impl ZipFileEntry

Source

pub fn mod_date(&self) -> (u16, u8, u8)

Parse the modification date from DOS format.

DOS date format packs year, month, and day into 16 bits:

  • Bits 0-4: Day (1-31)
  • Bits 5-8: Month (1-12)
  • Bits 9-15: Year offset from 1980
§Returns

A tuple of (year, month, day).

§Example
let (year, month, day) = entry.mod_date();
println!("Modified: {}-{:02}-{:02}", year, month, day);
Source

pub fn mod_time(&self) -> (u8, u8, u8)

Parse the modification time from DOS format.

DOS time format packs hour, minute, and second into 16 bits:

  • Bits 0-4: Second / 2 (0-29, representing 0-58 seconds)
  • Bits 5-10: Minute (0-59)
  • Bits 11-15: Hour (0-23)
§Returns

A tuple of (hour, minute, second).

§Example
let (hour, minute, second) = entry.mod_time();
println!("Time: {:02}:{:02}:{:02}", hour, minute, second);

Trait Implementations§

Source§

impl Clone for ZipFileEntry

Source§

fn clone(&self) -> ZipFileEntry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ZipFileEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more