MCPcopy Create free account
hub / github.com/archlinux/alpm / read_data_entry

Method read_data_entry

alpm-package/src/package.rs:916–927  ·  view source on GitHub ↗

Reads a [`TarballEntry`] matching a specific path name from the package archive. Returns [`None`] if no [`TarballEntry`] is found in the package archive that matches `path`. # Errors Returns an error if - [`PackageReader::data_entries`] fails to retrieve the data entries, - or retrieving the details of a data entry fails.

(
        &'a mut self,
        path: P,
    )

Source from the content-addressed store, hash-verified

914 /// - [`PackageReader::data_entries`] fails to retrieve the data entries,
915 /// - or retrieving the details of a data entry fails.
916 pub fn read_data_entry<'a, P: AsRef<Path>>(
917 &'a mut self,
918 path: P,
919 ) -> Result<Option<TarballEntry<'a, 'c>>, crate::Error> {
920 for entry in self.data_entries()? {
921 let entry = entry?;
922 if entry.path() == path.as_ref() {
923 return Ok(Some(entry));
924 }
925 }
926 Ok(None)
927 }
928}
929
930impl TryFrom<Package> for PackageReader<'_> {

Callers 1

read_package_contentsFunction · 0.80

Calls 3

data_entriesMethod · 0.80
pathMethod · 0.45
as_refMethod · 0.45

Tested by 1

read_package_contentsFunction · 0.64