FileMetadata

Struct FileMetadata 

Source
pub struct FileMetadata<'a> {
    pub size: usize,
    pub compressed_size: usize,
    pub compression_method: CompressionMethod,
    pub crc32: u32,
    pub encrypted: bool,
    pub path: Cow<'a, Utf8Path>,
    pub last_modified: NaiveDateTime,
    pub unix_mode: Option<u16>,
    /* private fields */
}
Expand description

Metadata for a file or directory in the archive, retrieved from its central directory

Fields§

§size: usize

Uncompressed size of the file in bytes

§compressed_size: usize

Compressed size of the file in bytes

§compression_method: CompressionMethod

Compression algorithm used to store the file

§crc32: u32

The CRC-32 of the decompressed file

§encrypted: bool

True if the file is encrypted (decryption is unsupported)

§path: Cow<'a, Utf8Path>

The provided path of the file.

§last_modified: NaiveDateTime

The ISO 8601 combined date and time the file was last modified

§unix_mode: Option<u16>

Unix mode bits, if the file was archived in a Unix OS.

This library does not try to convert DOS permission bits into roughly-equivalent Unix mode bits, or do other cross-OS handwaving. Future versions might provide an enum here of different OS’s metadata.

Implementations§

Source§

impl<'a> FileMetadata<'a>

Source

pub fn is_dir(&self) -> bool

Returns true if the given entry is a directory

Source

pub fn is_file(&self) -> bool

Returns true if the given entry is a file

Source

pub fn into_owned(self) -> FileMetadata<'static>

Trait Implementations§

Source§

impl<'a> Debug for FileMetadata<'a>

Source§

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

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

impl<'a> PartialEq for FileMetadata<'a>

Source§

fn eq(&self, other: &FileMetadata<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for FileMetadata<'a>

Source§

impl<'a> StructuralPartialEq for FileMetadata<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for FileMetadata<'a>

§

impl<'a> RefUnwindSafe for FileMetadata<'a>

§

impl<'a> Send for FileMetadata<'a>

§

impl<'a> Sync for FileMetadata<'a>

§

impl<'a> Unpin for FileMetadata<'a>

§

impl<'a> UnwindSafe for FileMetadata<'a>

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