doc: rustdocs
All checks were successful
/ check (push) Successful in 40s

This commit is contained in:
Didier Slof 2023-07-17 21:21:29 +02:00
parent 5fea156cfa
commit f51c5dc9d5
Signed by: didier
GPG key ID: 01E71F18AA4398E5

View file

@ -12,6 +12,7 @@ pub struct Package {
}
impl Package {
/// Create a new package from a package identifier and a package file.
pub fn new(identifier: identifier::PackageIdentifier, pkgfile: pkgfile::PKGFile) -> Package {
Package {
identifier,
@ -21,11 +22,7 @@ impl Package {
}
}
pub fn manifest(&self) -> manifest::Manifest {
manifest::Manifest::try_from(self.pkgfile.manifest.clone())
.unwrap()
}
/// Fetch a package from a package identifier.
pub fn fetch(package_identifier: identifier::PackageIdentifier) -> Result<Package, fetch::FetchError> {
match &package_identifier {
identifier::PackageIdentifier::Path(path) => {
@ -46,6 +43,14 @@ impl Package {
}
}
/// Get the package manifest.
pub fn manifest(&self) -> manifest::Manifest {
manifest::Manifest::try_from(self.pkgfile.manifest.clone())
.unwrap()
}
/// Install the package.
pub fn install(&mut self) -> Result<(), installer::errors::InstallError> {
let manifest = self.manifest();
let installer = installer::PackageInstaller::new(manifest.clone(), self.pkgfile.clone(), installer::InstallType::Bin);
@ -58,11 +63,18 @@ impl Package {
}
}
/// Check if the package is installed.
pub fn is_installed(&self) -> bool {
self.is_installed
}
/// Check if the package is indexed.
pub fn is_indexed(&self) -> bool {
self.is_indexed
}
/// Remove the package from the system.
pub fn remove(&mut self) -> Result<(), ()> {
unimplemented!();
}
}