Skip to main content

ParsedEntry

Struct ParsedEntry 

Source
pub struct ParsedEntry<'a> {
Show 15 fields pub header: &'a Header, pub entry_type: EntryType, pub path: Cow<'a, [u8]>, pub link_target: Option<Cow<'a, [u8]>>, pub mode: u32, pub uid: u64, pub gid: u64, pub mtime: u64, pub size: u64, pub uname: Option<Cow<'a, [u8]>>, pub gname: Option<Cow<'a, [u8]>>, pub dev_major: Option<u32>, pub dev_minor: Option<u32>, pub xattrs: Vec<(Cow<'a, [u8]>, Cow<'a, [u8]>)>, pub pax: Option<&'a [u8]>,
}
Expand description

A fully-resolved tar entry with all extensions applied.

Borrowed data comes from the input slice, so the entry is valid only as long as the input buffer is live.

Fields§

§header: &'a Header

The raw 512-byte header.

§entry_type: EntryType

The entry type (Regular, Directory, Symlink, etc.).

§path: Cow<'a, [u8]>

The resolved file path.

Priority: PAX path > GNU long name > header name (+ UStar prefix).

§link_target: Option<Cow<'a, [u8]>>

The resolved link target (for symlinks and hardlinks).

Priority: PAX linkpath > GNU long link > header linkname.

§mode: u32

File mode/permissions.

§uid: u64

Owner UID.

§gid: u64

Owner GID.

§mtime: u64

Modification time as Unix timestamp.

§size: u64

Content size in bytes.

§uname: Option<Cow<'a, [u8]>>

User name.

§gname: Option<Cow<'a, [u8]>>

Group name.

§dev_major: Option<u32>

Device major number (for block/char devices).

§dev_minor: Option<u32>

Device minor number (for block/char devices).

§xattrs: Vec<(Cow<'a, [u8]>, Cow<'a, [u8]>)>

Extended attributes from PAX SCHILY.xattr.* entries.

§pax: Option<&'a [u8]>

Raw PAX extended header data, if a PAX 'x' entry preceded this entry.

This is the unprocessed content of the PAX extension entry, preserved so that callers can iterate all PAX key-value pairs (not just the ones tar-core resolves into struct fields). Parse it with PaxExtensions::new.

Implementations§

Source§

impl<'a> ParsedEntry<'a>

Source

pub fn path_lossy(&self) -> Cow<'_, str>

Get the path as a lossy UTF-8 string.

Get the link target as a lossy UTF-8 string, if present.

Source

pub fn is_file(&self) -> bool

Check if this is a regular file.

Source

pub fn is_dir(&self) -> bool

Check if this is a directory.

Check if this is a symbolic link.

Check if this is a hard link.

Source

pub fn padded_size(&self) -> u64

Get the padded size (rounded up to block boundary).

Trait Implementations§

Source§

impl<'a> Debug for ParsedEntry<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ParsedEntry<'a>

§

impl<'a> RefUnwindSafe for ParsedEntry<'a>

§

impl<'a> Send for ParsedEntry<'a>

§

impl<'a> Sync for ParsedEntry<'a>

§

impl<'a> Unpin for ParsedEntry<'a>

§

impl<'a> UnsafeUnpin for ParsedEntry<'a>

§

impl<'a> UnwindSafe for ParsedEntry<'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.