pub struct DataEntry<'a, 'c> {
path: PathBuf,
entry: Entry<'a, CompressionDecoder<'c>>,
}
Expand description
A data file contained in the tar archive of an alpm-package file.
Wraps a PathBuf
that indicates the location of the file in the tar archive
and a tar Entry
that provides access to the data of the entry in the tar archive.
Read
is implemented to allow directly reading the contents of the tar archive entry.
§Notes
Uses two lifetimes for the entry
field:
'a
for the reference to theArchive
that theEntry
belongs to'c
for theCompressionDecoder
Fields§
§path: PathBuf
The path of the data entry in the package archive.
entry: Entry<'a, CompressionDecoder<'c>>
The raw tar entry that contains the data of the entry.
Implementations§
Source§impl<'a, 'c> DataEntry<'a, 'c>
impl<'a, 'c> DataEntry<'a, 'c>
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Returns the path of the data entry in the tar archive of the package.
Sourcepub fn is_dir(&self) -> bool
pub fn is_dir(&self) -> bool
Checks whether the DataEntry
represents a directory.
Returns true
if the DataEntry
represents a directory, false
otherwise.
§Note
This is a convenience method for comparing the EntryType
of the Entry::header
contained in the DataEntry
with EntryType::Directory
.
Sourcepub fn is_file(&self) -> bool
pub fn is_file(&self) -> bool
Checks whether the DataEntry
represents a regular file.
Returns true
if the DataEntry
represents a regular file, false
otherwise.
§Note
This is a convenience method for comparing the EntryType
of the Entry::header
contained in the DataEntry
with EntryType::Regular
.
Sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Checks whether the DataEntry
represents a symlink.
Returns true
if the DataEntry
represents a symlink, false
otherwise.
§Note
This is a convenience method for comparing the EntryType
of the Entry::header
contained in the DataEntry
with EntryType::Symlink
.
Sourcepub fn permissions(&self) -> Result<u32, Error>
pub fn permissions(&self) -> Result<u32, Error>
Returns the access permissions that apply for the DataEntry
.
§Notes
- This is a convenience method for retrieving the mode of the
Entry::header
contained in theDataEntry
. - It returns the mode masked with
0o7777
to ensure only the permission bits are returned.
§Errors
Returns an error if retrieving the mode from the entry’s header fails.
Sourcepub fn entry(&'a self) -> &'a Entry<'a, CompressionDecoder<'c>>
pub fn entry(&'a self) -> &'a Entry<'a, CompressionDecoder<'c>>
Returns a reference to the underlying tar Entry
.
This is useful for accessing metadata of the entry, such as its header or path.
Trait Implementations§
Source§impl Read for DataEntry<'_, '_>
impl Read for DataEntry<'_, '_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Reads data from the entry into the provided buffer.
Delegates to Entry::read
.
§Errors
Returns an error if reading from the entry fails.
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read more