pub struct Version<'a> { /* private fields */ }Implementations§
source§impl<'a> Version<'a>
impl<'a> Version<'a>
pub fn new(ptr: RawVersion, cache: &'a Cache) -> Version<'a>
sourcepub fn package_files(&self) -> impl Iterator<Item = RawPackageFile> + '_
pub fn package_files(&self) -> impl Iterator<Item = RawPackageFile> + '_
Returns an iterator of PackageFiles (Origins) for the version
sourcepub fn depends_map(&self) -> &HashMap<DepType, Vec<Dependency<'a>>>
pub fn depends_map(&self) -> &HashMap<DepType, Vec<Dependency<'a>>>
Returns a reference to the Dependency Map owned by the Version
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 DepType::Depends key:
use rust_apt::new_cache;
use rust_apt::package::DepType;
let cache = new_cache!().unwrap();
let pkg = cache.get("apt").unwrap();
let version = pkg.candidate().unwrap();
for dep in version.depends_map().get(&DepType::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: &DepType) -> Option<&Vec<Dependency<'a>>>
pub fn get_depends(&self, key: &DepType) -> Option<&Vec<Dependency<'a>>>
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<'a>>>
pub fn enhances(&self) -> Option<&Vec<Dependency<'a>>>
Returns a Reference Vector, if it exists, for “Enhances”.
sourcepub fn dependencies(&self) -> Option<Vec<&Dependency<'a>>>
pub fn dependencies(&self) -> Option<Vec<&Dependency<'a>>>
Returns a Reference Vector, if it exists, for “Depends” and “PreDepends”.
sourcepub fn recommends(&self) -> Option<&Vec<Dependency<'a>>>
pub fn recommends(&self) -> Option<&Vec<Dependency<'a>>>
Returns a Reference Vector, if it exists, for “Recommends”.
sourcepub fn suggests(&self) -> Option<&Vec<Dependency<'a>>>
pub fn suggests(&self) -> Option<&Vec<Dependency<'a>>>
Returns a Reference Vector, if it exists, for “suggests”.
sourcepub fn description(&self) -> Option<String>
pub fn description(&self) -> Option<String>
Get the translated long description
sourcepub fn get_record<T: ToString + ?Sized>(&self, field: &T) -> Option<String>
pub fn get_record<T: ToString + ?Sized>(&self, field: &T) -> Option<String>
Get data from the specified record field
§Returns:
- Some String or None if the field doesn’t exist.
§Example:
use rust_apt::new_cache;
use rust_apt::records::RecordField;
let cache = new_cache!().unwrap();
let pkg = cache.get("apt").unwrap();
let cand = pkg.candidate().unwrap();
println!("{}", cand.get_record(RecordField::Maintainer).unwrap());
// Or alternatively you can just pass any string
println!("{}", cand.get_record("Description-md5").unwrap());sourcepub fn hash<T: ToString + ?Sized>(&self, hash_type: &T) -> Option<String>
pub fn hash<T: ToString + ?Sized>(&self, hash_type: &T) -> Option<String>
Get the hash specified. If there isn’t one returns None
version.hash("md5sum")
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 uris(&'a self) -> impl Iterator<Item = String> + '_
pub fn uris(&'a self) -> impl Iterator<Item = String> + '_
Returns an iterator of URIs for the version
sourcepub fn set_candidate(&self)
pub fn set_candidate(&self)
Set this version as the candidate.
Methods from Deref<Target = RawVersion>§
sourcepub fn parent_pkg(&self) -> Package
pub fn parent_pkg(&self) -> Package
Return the version’s parent RawPackage.
sourcepub fn section(&self) -> Result<&str, Exception>
pub fn section(&self) -> Result<&str, Exception>
The section of the version as shown in apt show.
sourcepub fn priority_str(&self) -> Result<&str, Exception>
pub fn priority_str(&self) -> Result<&str, Exception>
The priority string as shown in apt show.
sourcepub fn installed_size(&self) -> u64
pub fn installed_size(&self) -> u64
The uncompressed size of the .deb file.
sourcepub fn is_downloadable(&self) -> bool
pub fn is_downloadable(&self) -> bool
True if the version is able to be downloaded.
sourcepub fn is_installed(&self) -> bool
pub fn is_installed(&self) -> bool
True if the version is currently installed
sourcepub fn source_name(&self) -> &str
pub fn source_name(&self) -> &str
Always contains the name, even if it is the same as the binary name
pub fn source_version(&self) -> &str
pub fn unsafe_provides(&self) -> Provider
pub fn unsafe_depends(&self) -> Dependency
pub fn unsafe_description_file(&self) -> DescriptionFile
pub fn unsafe_version_file(&self) -> VersionFile
sourcepub fn raw_next(&self)
pub fn raw_next(&self)
Return the parent package. TODO: This probably isn’t going to work rn pub fn parent(self: &Package) -> bool;
sourcepub fn end(&self) -> bool
pub fn end(&self) -> bool
This will tell you if the inner PkgIterator is null
The cxx is_null function will still show non null because of wrappers in c++
pub fn unique(&self) -> Version
pub fn provides_list(&self) -> Option<RawProvider>
pub fn depends(&self) -> Option<RawDependency>
pub fn version_files(&self) -> Option<RawVersionFile>
pub fn description_files(&self) -> Option<RawDescriptionFile>
Trait Implementations§
source§impl<'a> PartialEq for Version<'a>
impl<'a> PartialEq for Version<'a>
source§impl<'a> PartialOrd for Version<'a>
impl<'a> PartialOrd for Version<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more