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>
impl<'archive> File<'archive>
Sourcepub fn permissions(&self) -> Permissions
pub fn permissions(&self) -> Permissions
Returns the permissions of the file.
Sourcepub fn inode_ref(&self) -> InodeRef
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
.
Sourcepub fn is_extended(&self) -> bool
pub fn is_extended(&self) -> bool
Returns whether the file is an extended structure
Sourcepub fn hard_link_count(&self) -> u32
pub fn hard_link_count(&self) -> u32
Getter for the inode hard link count
Sourcepub fn parent_inode(&self) -> Inode
pub fn parent_inode(&self) -> Inode
Getter for the inode number of the parent directory.
Sourcepub fn follow_symlink(&mut self) -> Result<()>
pub fn follow_symlink(&mut self) -> Result<()>
Follow a single symbolic link.
After calling this function, the file is (in-place) changed to the target of the symlink.
Sourcepub fn follow_all_symlinks(&mut self) -> Result<()>
pub fn follow_all_symlinks(&mut self) -> Result<()>
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.
Sourcepub fn modified_time(&self) -> u32
pub fn modified_time(&self) -> u32
Getter for the modification time.
Returns the number of seconds since the Unix epoch.
Sourcepub fn symlink_path(&self) -> Option<&BStr>
pub fn symlink_path(&self) -> Option<&BStr>
Symbolic link target path.
If this file is not a symbolic link, this will return None
.
Sourcepub fn xattr_id(&self) -> u32
pub fn xattr_id(&self) -> u32
Returns index of the extended attribute inside of the xattr table.
Sourcepub fn as_dir(&self) -> Result<DirectoryIterator<'_, 'archive>>
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.
Sourcepub fn xattrs(&self) -> Result<XattrIterator<'_>>
pub fn xattrs(&self) -> Result<XattrIterator<'_>>
Returns an iterator over the extended attributes of the file.