pub struct Version<'a> { /* private fields */ }Expand description
A struct representing a version of an apt Package
Implementations
sourceimpl<'a> Version<'a>
impl<'a> Version<'a>
sourcepub fn priority_str(&self) -> String
pub fn priority_str(&self) -> String
The priority string as shown in apt show.
sourcepub fn source_name(&self) -> String
pub fn source_name(&self) -> String
The name of the source package the version was built from.
sourcepub fn source_version(&self) -> String
pub fn source_version(&self) -> String
The version of the source package.
sourcepub fn installed_size(&self) -> u64
pub fn installed_size(&self) -> u64
The uncompressed size of the .deb file.
sourcepub fn downloadable(&self) -> bool
pub fn downloadable(&self) -> bool
If the version is able to be downloaded.
sourcepub fn is_installed(&self) -> bool
pub fn is_installed(&self) -> bool
Check if the version is installed
sourcepub fn depends_map(&self) -> &HashMap<String, Vec<Dependency>>
pub fn depends_map(&self) -> &HashMap<String, Vec<Dependency>>
Returns a reference to the Dependency Map owned by the Version
let keys = [
"Depends",
"PreDepends",
"Suggests",
"Recommends",
"Conflicts",
"Replaces",
"Obsoletes",
"Breaks",
"Enhances",
];Dependencies are in a Vec<Dependency>
The Dependency struct represents an Or Group of dependencies.
The base deps are located in Dependency.base_deps
For example where we use the "Depends" key:
use rust_apt::cache::Cache;
let cache = Cache::new();
let version = cache.get("apt").unwrap().candidate().unwrap();
for dep in version.depends_map().get("Depends").unwrap() {
if dep.is_or() {
for base_dep in &dep.base_deps {
println!("{}", base_dep.name())
}
} else {
// is_or is false so there is only one BaseDep
println!("{}", dep.first().name())
}
}sourcepub fn get_depends(&self, key: &str) -> Option<&Vec<Dependency>>
pub fn get_depends(&self, key: &str) -> Option<&Vec<Dependency>>
Returns a reference Vector, if it exists, for the given key.
See the doc for depends_map() for more information.
sourcepub fn enhances(&self) -> Option<&Vec<Dependency>>
pub fn enhances(&self) -> Option<&Vec<Dependency>>
Returns a Reference Vector, if it exists, for “Enhances”.
sourcepub fn dependencies(&self) -> Option<Vec<&Dependency>>
pub fn dependencies(&self) -> Option<Vec<&Dependency>>
Returns a Reference Vector, if it exists, for “Depends” and “PreDepends”.
sourcepub fn recommends(&self) -> Option<&Vec<Dependency>>
pub fn recommends(&self) -> Option<&Vec<Dependency>>
Returns a Reference Vector, if it exists, for “Recommends”.
sourcepub fn suggests(&self) -> Option<&Vec<Dependency>>
pub fn suggests(&self) -> Option<&Vec<Dependency>>
Returns a Reference Vector, if it exists, for “suggests”.
sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get the translated long description
sourcepub fn sha256(&self) -> Option<String>
pub fn sha256(&self) -> Option<String>
Get the sha256 hash. If there isn’t one returns None
This is equivalent to version.hash("sha256")
sourcepub fn sha512(&self) -> Option<String>
pub fn sha512(&self) -> Option<String>
Get the sha512 hash. If there isn’t one returns None
This is equivalent to version.hash("sha512")
sourcepub fn hash(&self, hash_type: &str) -> Option<String>
pub fn hash(&self, hash_type: &str) -> Option<String>
Get the hash specified. If there isn’t one returns None
version.hash("md5sum")
sourcepub fn package_files(&self) -> impl Iterator<Item = PackageFile> + '_
pub fn package_files(&self) -> impl Iterator<Item = PackageFile> + '_
Returns an iterator of PackageFiles (Origins) for the version
Trait Implementations
sourceimpl<'a> PartialEq<Version<'a>> for Version<'a>
impl<'a> PartialEq<Version<'a>> for Version<'a>
sourceimpl<'a> PartialOrd<Version<'a>> for Version<'a>
impl<'a> PartialOrd<Version<'a>> for Version<'a>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Version<'a>
impl<'a> !Send for Version<'a>
impl<'a> !Sync for Version<'a>
impl<'a> !Unpin for Version<'a>
impl<'a> !UnwindSafe for Version<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more