Struct flate2::GzHeader

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

A structure representing the header of a gzip stream.

The header can contain metadata about the file that was compressed, if present.

Implementations§

source§

impl GzHeader

source

pub fn filename(&self) -> Option<&[u8]>

Returns the filename field of this gzip stream’s header, if present.

source

pub fn extra(&self) -> Option<&[u8]>

Returns the extra field of this gzip stream’s header, if present.

source

pub fn comment(&self) -> Option<&[u8]>

Returns the comment field of this gzip stream’s header, if present.

source

pub fn operating_system(&self) -> u8

Returns the operating_system field of this gzip stream’s header.

There are predefined values for various operating systems. 255 means that the value is unknown.

source

pub fn mtime(&self) -> u32

This gives the most recent modification time of the original file being compressed.

The time is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this may cause problems for MS-DOS and other systems that use local rather than Universal time.) If the compressed data did not come from a file, mtime is set to the time at which compression started. mtime = 0 means no time stamp is available.

The usage of mtime is discouraged because of Year 2038 problem.

source

pub fn mtime_as_datetime(&self) -> Option<SystemTime>

Returns the most recent modification time represented by a date-time type. Returns None if the value of the underlying counter is 0, indicating no time stamp is available.

The time is measured as seconds since 00:00:00 GMT, Jan. 1 1970. See mtime for more detail.

Trait Implementations§

source§

impl Clone for GzHeader

source§

fn clone(&self) -> GzHeader

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 GzHeader

source§

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

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

impl Default for GzHeader

source§

fn default() -> GzHeader

Returns the “default value” for a type. Read more
source§

impl PartialEq for GzHeader

source§

fn eq(&self, other: &GzHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for GzHeader

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.