Struct GnuHeader

#[repr(C)]
pub struct GnuHeader { pub name: [u8; 100], pub mode: [u8; 8], pub uid: [u8; 8], pub gid: [u8; 8], pub size: [u8; 12], pub mtime: [u8; 12], pub cksum: [u8; 8], pub typeflag: [u8; 1], pub linkname: [u8; 100], pub magic: [u8; 6], pub version: [u8; 2], pub uname: [u8; 32], pub gname: [u8; 32], pub dev_major: [u8; 8], pub dev_minor: [u8; 8], pub atime: [u8; 12], pub ctime: [u8; 12], pub offset: [u8; 12], pub longnames: [u8; 4], pub unused: [u8; 1], pub sparse: [GnuSparseHeader; 4], pub isextended: [u8; 1], pub realsize: [u8; 12], pub pad: [u8; 17] }

Representation of the header of an entry in an archive

Fields

name: [u8; 100]
mode: [u8; 8]
uid: [u8; 8]
gid: [u8; 8]
size: [u8; 12]
mtime: [u8; 12]
cksum: [u8; 8]
typeflag: [u8; 1]
linkname: [u8; 100]
magic: [u8; 6]
version: [u8; 2]
uname: [u8; 32]
gname: [u8; 32]
dev_major: [u8; 8]
dev_minor: [u8; 8]
atime: [u8; 12]
ctime: [u8; 12]
offset: [u8; 12]
longnames: [u8; 4]
unused: [u8; 1]
sparse: [GnuSparseHeader; 4]
isextended: [u8; 1]
realsize: [u8; 12]
pad: [u8; 17]

Implementations

impl GnuHeader

fn username_bytes(&self) -> &[u8]

See Header::username_bytes

fn set_username(&mut self, name: &str) -> Result<()>

See Header::set_username

fn groupname_bytes(&self) -> &[u8]

See Header::groupname_bytes

fn set_groupname(&mut self, name: &str) -> Result<()>

See Header::set_groupname

fn device_major(&self) -> Result<u32>

See Header::device_major

fn set_device_major(&mut self, major: u32)

See Header::set_device_major

fn device_minor(&self) -> Result<u32>

See Header::device_minor

fn set_device_minor(&mut self, minor: u32)

See Header::set_device_minor

fn atime(&self) -> Result<u64>

Returns the last modification time in Unix time format

fn set_atime(&mut self, atime: u64)

Encodes the atime provided into this header.

Note that this time is typically a number of seconds passed since January 1, 1970.

fn ctime(&self) -> Result<u64>

Returns the last modification time in Unix time format

fn set_ctime(&mut self, ctime: u64)

Encodes the ctime provided into this header.

Note that this time is typically a number of seconds passed since January 1, 1970.

fn real_size(&self) -> Result<u64>

Returns the "real size" of the file this header represents.

This is applicable for sparse files where the returned size here is the size of the entire file after the sparse regions have been filled in.

fn set_real_size(&mut self, real_size: u64)

Encodes the real_size provided into this header.

fn is_extended(&self) -> bool

Indicates whether this header will be followed by additional sparse-header records.

Note that this is handled internally by this library, and is likely only interesting if a raw iterator is being used.

fn set_is_extended(&mut self, is_extended: bool)

Sets whether this header should be followed by additional sparse-header records.

To append a sparse std::fs::File to an archive, prefer using the crate::Builder instead.

fn as_header(&self) -> &Header

Views this as a normal Header

fn as_header_mut(&mut self) -> &mut Header

Views this as a normal Header

Trait Implementations

impl Debug for GnuHeader

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

Auto Trait Implementations

impl Freeze for GnuHeader

impl RefUnwindSafe for GnuHeader

impl Send for GnuHeader

impl Sync for GnuHeader

impl Unpin for GnuHeader

impl UnsafeUnpin for GnuHeader

impl UnwindSafe for GnuHeader

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for GnuHeader

fn from(t: T) -> T

Returns the argument unchanged.

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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