doc: rustdocs
This commit is contained in:
parent
3293e407ae
commit
e3552e9208
1 changed files with 17 additions and 5 deletions
|
@ -12,6 +12,7 @@ pub struct Package {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
pub fn new(identifier: identifier::PackageIdentifier, pkgfile: pkgfile::PKGFile) -> Package {
|
||||||
Package {
|
Package {
|
||||||
identifier,
|
identifier,
|
||||||
|
@ -21,11 +22,7 @@ impl Package {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn manifest(&self) -> manifest::Manifest {
|
/// Fetch a package from a package identifier.
|
||||||
manifest::Manifest::try_from(self.pkgfile.manifest.clone())
|
|
||||||
.unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn fetch(package_identifier: identifier::PackageIdentifier) -> Result<Package, fetch::FetchError> {
|
pub fn fetch(package_identifier: identifier::PackageIdentifier) -> Result<Package, fetch::FetchError> {
|
||||||
match &package_identifier {
|
match &package_identifier {
|
||||||
identifier::PackageIdentifier::Path(path) => {
|
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> {
|
pub fn install(&mut self) -> Result<(), installer::errors::InstallError> {
|
||||||
let manifest = self.manifest();
|
let manifest = self.manifest();
|
||||||
let installer = installer::PackageInstaller::new(manifest.clone(), self.pkgfile.clone(), installer::InstallType::Bin);
|
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 {
|
pub fn is_installed(&self) -> bool {
|
||||||
self.is_installed
|
self.is_installed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check if the package is indexed.
|
||||||
pub fn is_indexed(&self) -> bool {
|
pub fn is_indexed(&self) -> bool {
|
||||||
self.is_indexed
|
self.is_indexed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Remove the package from the system.
|
||||||
|
pub fn remove(&mut self) -> Result<(), ()> {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue