Struct gzip_header::GzHeader
[−]
[src]
pub struct GzHeader { /* fields omitted */ }
A structure representing the raw header of a gzip stream.
The header can contain metadata about the file that was compressed, if present.
Methods
impl GzHeader
[src]
fn filename(&self) -> Option<&[u8]>
Returns the filename
field of this gzip header, if present.
The filename
field the gzip header is supposed to be stored using ISO 8859-1 (LATIN-1)
encoding and be zero-terminated if following the specification.
fn extra(&self) -> Option<&[u8]>
Returns the extra
field of this gzip header, if present.
fn comment(&self) -> Option<&[u8]>
Returns the comment
field of this gzip stream's header, if present.
The comment
field in the gzip header is supposed to be stored using ISO 8859-1 (LATIN-1)
encoding and be zero-terminated if following the specification.
fn mtime(&self) -> u32
Returns the mtime
field of this gzip header.
This gives the most recent modification time of the contained file, or alternatively
the timestamp of when the file was compressed if the data did not come from a file, or
a timestamp was not available when compressing. The time is specified the Unix format,
that is: seconds since 00:00:00 GMT, Jan. 1, 1970. (Not that this may cause problems for
MS-DOS and other systems that use local rather than Universal time.)
An mtime
value of 0 means that the timestamp is not set.
fn mtime_as_datetime(&self) -> Option<SystemTime>
Returns the mtime
field of this gzip header as a SystemTime
if present.
Returns None
if the mtime
is not set, i.e 0.
See mtime
for more detail.
fn os(&self) -> u8
Returns the os
field of this gzip stream's header.
fn xfl(&self) -> u8
Returns the xfl
field of this gzip stream's header.
Trait Implementations
impl Debug for GzHeader
[src]
impl Clone for GzHeader
[src]
fn clone(&self) -> GzHeader
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for GzHeader
[src]
fn eq(&self, __arg_0: &GzHeader) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &GzHeader) -> bool
This method tests for !=
.
impl Eq for GzHeader
[src]
impl Hash for GzHeader
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for GzHeader
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Crudely display the contents of the header
Note that filename/commend are required to be ISO 8859-1 (LATIN-1) encoded by the spec, however to avoid dragging in dependencies we simply interpret them as UTF-8. This may result in garbled output if the names contain special characters.