Struct tar_no_std::PosixHeader
source · [−]#[repr(C, packed)]pub struct PosixHeader {Show 17 fields
pub name: StaticCString<100>,
pub mode: Mode,
pub uid: [u8; 8],
pub gid: [u8; 8],
pub size: Size,
pub mtime: [u8; 12],
pub cksum: [u8; 8],
pub typeflag: TypeFlag,
pub linkname: StaticCString<100>,
pub magic: StaticCString<6>,
pub version: StaticCString<2>,
pub uname: StaticCString<32>,
pub gname: StaticCString<32>,
pub dev_major: [u8; 8],
pub dev_minor: [u8; 8],
pub prefix: StaticCString<155>,
pub _pad: [u8; 12],
}Expand description
Header of the TAR format as specified by POSIX (POSIX 1003.1-1990. “New” (version?) GNU Tar versions use this archive format by default. (https://www.gnu.org/software/tar/manual/html_node/Formats.html#Formats).
Each file is started by such a header, that describes the size and the file name. After that, the file content stands in chunks of 512 bytes. The number of bytes can be derived from the file size.
This is also mostly compatible with the “Ustar”-header and the “GNU format”. Because this library only needs to fetch data and filename, we don’t need further checks.
Fields
name: StaticCString<100>Name. There is always a null byte, therefore the max len is 99.
mode: Modeuid: [u8; 8]gid: [u8; 8]size: Sizemtime: [u8; 12]cksum: [u8; 8]typeflag: TypeFlaglinkname: StaticCString<100>Name. There is always a null byte, therefore the max len is 99.
magic: StaticCString<6>version: StaticCString<2>uname: StaticCString<32>Username. There is always a null byte, therefore the max len is N-1.
gname: StaticCString<32>Groupname. There is always a null byte, therefore the max len is N-1.
dev_major: [u8; 8]dev_minor: [u8; 8]prefix: StaticCString<155>There is always a null byte, therefore the max len is N-1.
_pad: [u8; 12]Implementations
sourceimpl PosixHeader
impl PosixHeader
sourcepub fn payload_block_count(&self) -> usize
pub fn payload_block_count(&self) -> usize
Returns the number of blocks that are required to read the whole file content.
sourcepub fn is_zero_block(&self) -> bool
pub fn is_zero_block(&self) -> bool
A Tar archive is terminated, if a end-of-archive entry, which consists of two 512 blocks of zero bytes, is found.
Trait Implementations
sourceimpl Clone for PosixHeader
impl Clone for PosixHeader
sourcefn clone(&self) -> PosixHeader
fn clone(&self) -> PosixHeader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for PosixHeader
impl Debug for PosixHeader
impl Copy for PosixHeader
Auto Trait Implementations
impl RefUnwindSafe for PosixHeader
impl Send for PosixHeader
impl Sync for PosixHeader
impl Unpin for PosixHeader
impl UnwindSafe for PosixHeader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more