pub struct Entry {
name: EntryName,
alpm_db_desc: EntryComponent,
alpm_db_files: EntryComponent,
alpm_install_scriptlet: Option<EntryComponent>,
alpm_mtree: EntryComponent,
}Expand description
The representation of an entry in an alpm-db.
Each entry is represented by a directory, containing a set of file components. File components are distinguished between mandatory ones (ALPM-MTREE, alpm-db-desc and alpm-db-files) and optional ones (alpm-install-scriptlet).
Fields§
§name: EntryNameThe name of the entry.
alpm_db_desc: EntryComponent§alpm_db_files: EntryComponent§alpm_install_scriptlet: Option<EntryComponent>§alpm_mtree: EntryComponentImplementations§
Source§impl Entry
impl Entry
Sourcepub fn new(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn new(path: impl AsRef<Path>) -> Result<Self, Error>
Creates a new Entry from a path.
The path represents an [alpm-db] entry, which must contain the alpm-db-desc,
alpm-db-files and ALPM-MTREE components and optionally the alpm-install-scriptlet
component.
§Errors
Returns an error, if
pathcannot be canonicalized- metadata for
pathcannot be retrieved pathis not a directorypathis world-writable- an
EntryNamecannot be created from the file name ofpath - a file for an alpm-db-desc, alpm-db-files or ALPM-MTREE component cannot be found
- the optional alpm-install-scriptlet component is not a file
Sourcepub fn version(&self) -> &FullVersion
pub fn version(&self) -> &FullVersion
Returns a reference to the FullVersion of the entry.
Sourcepub fn db_desc(&mut self) -> Result<DbDescFile, Error>
pub fn db_desc(&mut self) -> Result<DbDescFile, Error>
Returns the DbDescFile.
§Note
Reads from the underlying file handle and afterwards rewinds it.
§Errors
Returns an errof if
- a new
DbDescFilecannot be created from the file handle - the file handle cannot be rewound
- the
EntryNameof the entry directory and that of theDbDescFilecomponent do not match
Sourcepub fn install_scriptlet(&mut self) -> Result<Option<String>, Error>
pub fn install_scriptlet(&mut self) -> Result<Option<String>, Error>
Returns the optional alpm-install-scriptlet as String.
§Note
Reads from the underlying file handle and afterwards rewinds it.
Returns Ok(None), if the entry has no alpm-install-scriptlet.
§Errors
Returns an errof if
- a new alpm-install-scriptlet cannot be created from the file handle
- the file handle cannot be rewound