Struct File

Source
pub struct File<'archive> { /* private fields */ }
Expand description

A file in a squashfs archive.

Note that directories, symlinks, and other special files are also represented as File.

Files are created from an Archive with e.g. Archive::open.

Implementations§

Source§

impl<'archive> File<'archive>

Source

pub fn file_type(&self) -> Option<FileType>

Returns the type of the file.

Source

pub fn permissions(&self) -> Permissions

Returns the permissions of the file.

Source

pub fn inode_ref(&self) -> InodeRef

Returns the inode reference of the file.

This can for example be used to re-open the file with Archive::open_ref.

Source

pub fn is_extended(&self) -> bool

Returns whether the file is an extended structure

Getter for the inode hard link count

Source

pub fn size(&self) -> u64

Getter for the file size. 0 if the file has no size.

Source

pub fn inode(&self) -> Inode

Getter for the inode number.

Source

pub fn parent_inode(&self) -> Inode

Getter for the inode number of the parent directory.

Follow a single symbolic link.

After calling this function, the file is (in-place) changed to the target of the symlink.

Follow symlink targets recursively until a non-symlink file is found.

After calling this function, the file is (in-place) changed to the target of the symlink(s).

This function performs recursion detection and will return an error if a symlink loop is detected.

Source

pub fn modified_time(&self) -> u32

Getter for the modification time.

Returns the number of seconds since the Unix epoch.

Symbolic link target path.

If this file is not a symbolic link, this will return None.

Source

pub fn device_id(&self) -> u32

Returns the device id of the device inode.

Source

pub fn uid(&self) -> u32

Returns the owner user id of the file.

Source

pub fn gid(&self) -> u32

Returns the owner group id of the file.

Source

pub fn xattr_id(&self) -> u32

Returns index of the extended attribute inside of the xattr table.

Source

pub fn as_dir(&self) -> Result<DirectoryIterator<'_, 'archive>>

Returns an iterator over the directory entries of the file.

If the file is not a directory, this will return an error.

Source

pub fn xattrs(&self) -> Result<XattrIterator<'_>>

Returns an iterator over the extended attributes of the file.

Source

pub fn reader(&self) -> Result<Reader<'_>>

Returns a new reader for the file.

Source

pub fn traversal(&self) -> Result<Traversal<'_>>

Returns a new traversal for the file.

A traversal is used to recursively traverse the file tree starting from this file/directory.

Trait Implementations§

Source§

impl<'archive> Debug for File<'archive>

Source§

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

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

impl<'archive> Drop for File<'archive>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'archive> Send for File<'archive>

Source§

impl<'archive> Sync for File<'archive>

Auto Trait Implementations§

§

impl<'archive> Freeze for File<'archive>

§

impl<'archive> RefUnwindSafe for File<'archive>

§

impl<'archive> Unpin for File<'archive>

§

impl<'archive> UnwindSafe for File<'archive>

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.