Struct async_zip2::ZipEntry

source ·
pub struct ZipEntry { /* private fields */ }
Expand description

An immutable store of data about a ZIP entry.

This type cannot be directly constructed so instead, the ZipEntryBuilder must be used. Internally this builder stores a ZipEntry so conversions between these two types via the From implementations will be non-allocating.

Implementations§

source§

impl ZipEntry

source

pub fn filename(&self) -> &ZipString

Returns the entry’s filename.

Note

This will return the raw filename stored during ZIP creation. If calling this method on entries retrieved from untrusted ZIP files, the filename should be sanitised before being used as a path to prevent directory traversal attacks.

source

pub fn compression(&self) -> Compression

Returns the entry’s compression method.

source

pub fn crc32(&self) -> u32

Returns the entry’s CRC32 value.

source

pub fn uncompressed_size(&self) -> u64

Returns the entry’s uncompressed size.

source

pub fn compressed_size(&self) -> u64

Returns the entry’s compressed size.

source

pub fn attribute_compatibility(&self) -> AttributeCompatibility

Returns the entry’s attribute’s host compatibility.

source

pub fn last_modification_date(&self) -> &ZipDateTime

Returns the entry’s last modification time & date.

source

pub fn internal_file_attribute(&self) -> u16

Returns the entry’s internal file attribute.

source

pub fn external_file_attribute(&self) -> u32

Returns the entry’s external file attribute

source

pub fn extra_fields(&self) -> &[ExtraField]

Returns the entry’s extra field data.

source

pub fn comment(&self) -> &ZipString

Returns the entry’s file comment.

source

pub fn unix_permissions(&self) -> Option<u16>

Returns the entry’s integer-based UNIX permissions.

Note

This will return None if the attribute host compatibility is not listed as Unix.

source

pub fn dir(&self) -> Result<bool>

Returns whether or not the entry represents a directory.

Trait Implementations§

source§

impl Clone for ZipEntry

source§

fn clone(&self) -> ZipEntry

Returns a copy 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 ZipEntry

source§

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

Formats the value using the given formatter. Read more
source§

impl From<ZipEntry> for ZipEntryBuilder

source§

fn from(entry: ZipEntry) -> Self

Converts to this type from the input type.
source§

impl From<ZipEntryBuilder> for ZipEntry

source§

fn from(builder: ZipEntryBuilder) -> Self

Converts to this type from the input type.

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.