Debian Codegraph @

src/iterators/version.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/::OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
5
6 use cxxrust-analyzer cargo cxx 1.0.199 crate/::UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#;
7
8 use craterust-analyzer cargo rust-apt 0.8.0 crate/::rawrust-analyzer cargo rust-apt 0.8.0 raw/::{IntoRawIterrust-analyzer cargo rust-apt 0.8.0 raw/IntoRawIter#, VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#};
9 use craterust-analyzer cargo rust-apt 0.8.0 crate/::utilrust-analyzer cargo rust-apt 0.8.0 util/::cmp_versionsrust-analyzer cargo rust-apt 0.8.0 util/cmp_versions().;
10 use craterust-analyzer cargo rust-apt 0.8.0 crate/::{
11 create_depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/create_depends_map()., Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#, DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#, Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#, Packagerust-analyzer cargo rust-apt 0.8.0 iterators/package/Package#, PackageFilerust-analyzer cargo rust-apt 0.8.0 iterators/files/PackageFile#, PackageRecordsrust-analyzer cargo rust-apt 0.8.0 records/PackageRecords#, Providerrust-analyzer cargo rust-apt 0.8.0 iterators/provider/Provider#,
12 VersionFilerust-analyzer cargo rust-apt 0.8.0 iterators/files/VersionFile#,
13 };
14
15 /// Represents a single Version of a package.
16 pub struct Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
17 pub(craterust-analyzer cargo rust-apt 0.8.0 crate/) ptrrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#ptr.: UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#>,
18 cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache.: &'a Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#,
19 depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#depends_map.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>>>,
20 }
21
22 impl<'a> Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
23 pub fn newrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]new().(ptr: UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#>, cache: &'a Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#) -> Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
24 Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version# {
25 ptrrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#ptr.,
26 cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache.,
27 depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#depends_map.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]new().(),
28 }
29 }
30
31 /// Returns a list of providers
32 pub fn providesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]provides().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Providerrust-analyzer cargo rust-apt 0.8.0 iterators/provider/Provider#<'a>> {
33 unsafe { self.ptrrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#ptr..providesrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]provides().() }
34 .raw_iterrust-analyzer cargo rust-apt 0.8.0 raw/impl#[`UniquePtr<PrvIterator>`][IntoRawIter]raw_iter().()
35 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|p| Providerrust-analyzer cargo rust-apt 0.8.0 iterators/provider/Provider#::newrust-analyzer cargo rust-apt 0.8.0 iterators/provider/impl#[`Provider<'a>`]new().(p, self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache.))
36 }
37
38 pub fn version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]version_files().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = VersionFilerust-analyzer cargo rust-apt 0.8.0 iterators/files/VersionFile#<'a>> {
39 unsafe { self.ptrrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#ptr..version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version_files().() }
40 .raw_iterrust-analyzer cargo rust-apt 0.8.0 raw/impl#[`UniquePtr<VerFileIterator>`][IntoRawIter]raw_iter().()
41 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| VersionFilerust-analyzer cargo rust-apt 0.8.0 iterators/files/VersionFile#::newrust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`VersionFile<'a>`]new().(v, self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache.))
42 }
43
44 /// Returns an iterator of PackageFiles (Origins) for the version
45 pub fn package_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]package_files().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = PackageFilerust-analyzer cargo rust-apt 0.8.0 iterators/files/PackageFile#<'a>> {
46 self.version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]version_files().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.package_filerust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`VersionFile<'a>`]package_file().())
47 }
48
49 /// Return the version's parent package.
50 pub fn parentrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]parent().(&self) -> Packagerust-analyzer cargo rust-apt 0.8.0 iterators/package/Package#<'a> { Packagerust-analyzer cargo rust-apt 0.8.0 iterators/package/Package#::newrust-analyzer cargo rust-apt 0.8.0 iterators/package/impl#[`Package<'a>`]new().(self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache., unsafe { self.parent_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]parent_pkg().() }) }
51
52 /// Returns a reference to the Dependency Map owned by the Version
53 ///
54 /// Dependencies are in a `Vec<Dependency>`
55 ///
56 /// The Dependency struct represents an Or Group of dependencies.
57 /// The base deps are located in `Dependency.base_deps`
58 ///
59 /// For example where we use the `DepType::Depends` key:
60 ///
61 /// ```
62 /// use rust_apt::{new_cache, DepType};
63 /// let cache = new_cache!().unwrap();
64 /// let pkg = cache.get("apt").unwrap();
65 /// let version = pkg.candidate().unwrap();
66 /// for dep in version.depends_map().get(&DepType::Depends).unwrap() {
67 /// if dep.is_or() {
68 /// for base_dep in dep.iter() {
69 /// println!("{}", base_dep.name())
70 /// }
71 /// } else {
72 /// // is_or is false so there is only one BaseDep
73 /// println!("{}", dep.first().name())
74 /// }
75 /// }
76 /// ```
77 pub fn depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]depends_map().(&self) -> &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>> {
78 self.depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#depends_map.
79 .get_or_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get_or_init().(|| create_depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/create_depends_map().(self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache., unsafe { self.dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]depends().().make_saferust-analyzer cargo rust-apt 0.8.0 raw/impl#[`UniquePtr<DepIterator>`][IntoRawIter]make_safe().() }))
80 }
81
82 /// Returns a reference Vector, if it exists, for the given key.
83 ///
84 /// See the doc for `depends_map()` for more information.
85 pub fn get_dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]get_depends().(&self, key: &DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>> {
86 self.depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]depends_map().().getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(key)
87 }
88
89 /// Returns a Reference Vector, if it exists, for "Enhances".
90 pub fn enhancesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]enhances().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>> { self.get_dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]get_depends().(&DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Enhancesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Enhances#) }
91
92 /// Returns a Reference Vector, if it exists,
93 /// for "Depends" and "PreDepends".
94 pub fn dependenciesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]dependencies().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>> {
95 let mut ret_vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
96
97 for dep_type in [DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Dependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Depends#, DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::PreDependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#PreDepends#] {
98 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dep_list) = self.get_dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]get_depends().(&dep_type) {
99 for dep in dep_list {
100 ret_vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(dep)
101 }
102 }
103 }
104
105 if ret_vec.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
106 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
107 }
108 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ret_vec)
109 }
110
111 /// Returns a Reference Vector, if it exists, for "Recommends".
112 pub fn recommendsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]recommends().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>> {
113 self.get_dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]get_depends().(&DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Recommendsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Recommends#)
114 }
115
116 /// Returns a Reference Vector, if it exists, for "suggests".
117 pub fn suggestsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]suggests().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a>>> { self.get_dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]get_depends().(&DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Suggestsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Suggests#) }
118
119 /// Move the PkgRecords into the correct place for the Description
120 fn desc_lookuprust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]desc_lookup().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&PackageRecordsrust-analyzer cargo rust-apt 0.8.0 records/PackageRecords#> {
121 let desc = unsafe { self.translated_descrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]translated_desc().().make_saferust-analyzer cargo rust-apt 0.8.0 raw/impl#[`UniquePtr<DescIterator>`][IntoRawIter]make_safe().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch(). };
122 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache..recordsrust-analyzer cargo rust-apt 0.8.0 cache/impl#[Cache]records().().desc_lookuprust-analyzer cargo rust-apt 0.8.0 records/impl#[PackageRecords]desc_lookup().(&desc))
123 }
124
125 /// Get the translated long description
126 pub fn descriptionrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]description().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { self.desc_lookuprust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]desc_lookup().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..long_descrust-analyzer cargo rust-apt 0.8.0 records/impl#[PackageRecords]long_desc().() }
127
128 /// Get the translated short description
129 pub fn summaryrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]summary().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { self.desc_lookuprust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]desc_lookup().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..short_descrust-analyzer cargo rust-apt 0.8.0 records/impl#[PackageRecords]short_desc().() }
130
131 /// Get data from the specified record field
132 ///
133 /// # Returns:
134 /// * Some String or None if the field doesn't exist.
135 ///
136 /// # Example:
137 /// ```
138 /// use rust_apt::new_cache;
139 /// use rust_apt::records::RecordField;
140 ///
141 /// let cache = new_cache!().unwrap();
142 /// let pkg = cache.get("apt").unwrap();
143 /// let cand = pkg.candidate().unwrap();
144 ///
145 /// println!("{}", cand.get_record(RecordField::Maintainer).unwrap());
146 /// // Or alternatively you can just pass any string
147 /// println!("{}", cand.get_record("Description-md5").unwrap());
148 /// ```
149 pub fn get_recordrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]get_record().<T: ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, field: &T) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
150 self.version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]version_files().()
151 .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().
152 .lookuprust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`VersionFile<'a>`]lookup().()
153 .get_fieldrust-analyzer cargo rust-apt 0.8.0 records/impl#[PackageRecords]get_field().(field.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#to_string().())
154 }
155
156 /// Get the hash specified. If there isn't one returns None
157 /// `version.hash("md5sum")`
158 pub fn hashrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]hash().<T: ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, hash_type: &T) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
159 self.version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]version_files().()
160 .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().
161 .lookuprust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`VersionFile<'a>`]lookup().()
162 .hash_findrust-analyzer cargo rust-apt 0.8.0 records/impl#[PackageRecords]hash_find().(hash_type.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#to_string().())
163 }
164
165 /// Get the sha256 hash. If there isn't one returns None
166 /// This is equivalent to `version.hash("sha256")`
167 pub fn sha256rust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]sha256().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { self.hashrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]hash().("sha256") }
168
169 /// Get the sha512 hash. If there isn't one returns None
170 /// This is equivalent to `version.hash("sha512")`
171 pub fn sha512rust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]sha512().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { self.hashrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]hash().("sha512") }
172
173 /// Returns an Iterator of URIs for the Version.
174 pub fn urisrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]uris().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> + 'a {
175 self.version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]version_files().().filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|v| {
176 let pkg_file = v.package_filerust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`VersionFile<'a>`]package_file().();
177 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().pkg_file.is_downloadablerust-analyzer cargo rust-apt 0.8.0 iterators/files/raw/impl#[PkgFileIterator]is_downloadable().() {
178 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
179 }
180 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg_file.index_filerust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`PackageFile<'a>`]index_file().().archive_urirust-analyzer cargo rust-apt 0.8.0 records/raw/impl#[IndexFile]archive_uri().(&v.lookuprust-analyzer cargo rust-apt 0.8.0 iterators/files/impl#[`VersionFile<'a>`]lookup().().filenamerust-analyzer cargo rust-apt 0.8.0 records/impl#[PackageRecords]filename().()))
181 })
182 }
183
184 /// Set this version as the candidate.
185 pub fn set_candidaterust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]set_candidate().(&self) { self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache..depcacherust-analyzer cargo rust-apt 0.8.0 cache/impl#[Cache]depcache().().set_candidate_versionrust-analyzer cargo rust-apt 0.8.0 depcache/raw/impl#[PkgDepCache]set_candidate_version().(self); }
186
187 /// The priority of the Version as shown in `apt policy`.
188 pub fn priorityrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]priority().(&self) -> i32 { self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#cache..priorityrust-analyzer cargo rust-apt 0.8.0 cache/raw/impl#[PkgCacheFile]priority().(self) }
189 }
190
191 // Implementations for comparing versions.
192 impl<'a> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
193 fn eqrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`][`PartialEq<Self>`]) -> bool {
194 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(
195 cmp_versionsrust-analyzer cargo rust-apt 0.8.0 util/cmp_versions().(self.versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().(), other.versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().()),
196 Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal#
197 )
198 }
199 }
200
201 impl<'a> PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
202 fn partial_cmprust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> {
203 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cmp_versionsrust-analyzer cargo rust-apt 0.8.0 util/cmp_versions().(self.versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().(), other.versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().()))
204 }
205 }
206
207 impl<'a> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
208 fn fmtrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
209 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
210 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
211 }
212 }
213
214 impl<'a> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#<'a> {
215 fn fmtrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
216 let parent = self.parentrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]parent().();
217 f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("Version")
218 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("pkg", &parent.namerust-analyzer cargo rust-apt 0.8.0 iterators/package/raw/impl#[PkgIterator]name().())
219 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("arch", &self.archrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]arch().())
220 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("version", &self.versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().())
221 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().(
222 "is_candidate",
223 &parent.candidaterust-analyzer cargo rust-apt 0.8.0 iterators/package/impl#[`Package<'a>`]candidate().().is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|cand| self rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().&cand),
224 )
225 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("is_installed", &self.is_installedrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]is_installed().())
226 .finish_non_exhaustiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish_non_exhaustive().()
227 }
228 }
229
230 #[cxxrust-analyzer cargo cxx 1.0.199 crate/::bridgerust-analyzer cargo cxxbridge-macro 1.0.199 bridge:]
231 pub(craterust-analyzer cargo rust-apt 0.8.0 crate/) mod rawrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/ {
232 impl CxxVector<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#> {}
233 unsafe extern "C++" {
234 includerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include!!("rust-apt/apt-pkg-c/package.h");
235
236 type VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#;
237
238 type PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/PkgIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::iteratorsrust-analyzer cargo rust-apt 0.8.0 iterators/::PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/package/raw/PkgIterator#;
239 type PrvIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/PrvIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::iteratorsrust-analyzer cargo rust-apt 0.8.0 iterators/::PrvIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/provider/raw/PrvIterator#;
240 type DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/DepIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::iteratorsrust-analyzer cargo rust-apt 0.8.0 iterators/::DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#;
241 type DescIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/DescIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::iteratorsrust-analyzer cargo rust-apt 0.8.0 iterators/::DescIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/files/raw/DescIterator#;
242 type VerFileIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerFileIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::iteratorsrust-analyzer cargo rust-apt 0.8.0 iterators/::VerFileIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/files/raw/VerFileIterator#;
243
244 /// The version string of the version. "1.4.10".
245 pub fn versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> &str;
246
247 /// The Arch of the version. "amd64".
248 pub fn archrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]arch().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> &str;
249
250 /// Return the version's parent PkgIterator.
251 ///
252 /// # Safety
253 ///
254 /// The returned UniquePtr cannot outlive the cache.
255 unsafe fn parent_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]parent_pkg().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/PkgIterator#>;
256
257 /// The section of the version as shown in `apt show`.
258 pub fn sectionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]section().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&str>;
259
260 /// The priority string as shown in `apt show`.
261 pub fn priority_strrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]priority_str().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&str>;
262
263 /// The size of the .deb file.
264 pub fn sizerust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]size().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> u64;
265
266 /// The uncompressed size of the .deb file.
267 pub fn installed_sizerust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]installed_size().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> u64;
268
269 /// True if the version is able to be downloaded.
270 #[cxx_name = "Downloadable"]
271 pub fn is_downloadablerust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]is_downloadable().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> bool;
272
273 /// True if the version is currently installed
274 pub fn is_installedrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]is_installed().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> bool;
275
276 /// Always contains the name, even if it is the same as the binary name
277 pub fn source_namerust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]source_name().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> &str;
278
279 // Always contains the version string,
280 // even if it is the same as the binary version.
281 pub fn source_versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]source_version().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> &str;
282
283 /// Return Providers Iterator
284 ///
285 /// # Safety
286 ///
287 /// If the inner pointer is null segfaults can occur.
288 ///
289 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
290 /// is recommended.
291 ///
292 /// The returned UniquePtr cannot outlive the cache.
293 unsafe fn providesrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]provides().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<PrvIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/PrvIterator#>;
294
295 /// Return Dependency Iterator
296 ///
297 /// # Safety
298 ///
299 /// If the inner pointer is null segfaults can occur.
300 ///
301 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
302 /// is recommended.
303 ///
304 /// The returned UniquePtr cannot outlive the cache.
305 unsafe fn dependsrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]depends().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/DepIterator#>;
306
307 /// Return the version files.
308 /// You go through here to get the package files.
309 ///
310 /// # Safety
311 ///
312 /// If the inner pointer is null segfaults can occur.
313 ///
314 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
315 /// is recommended.
316 ///
317 /// The returned UniquePtr cannot outlive the cache.
318 unsafe fn version_filesrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version_files().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<VerFileIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerFileIterator#>;
319
320 /// This is for backend records lookups.
321 ///
322 /// # Safety
323 ///
324 /// If the inner pointer is null segfaults can occur.
325 ///
326 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
327 /// is recommended.
328 ///
329 /// The returned UniquePtr cannot outlive the cache.
330 unsafe fn translated_descrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]translated_desc().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<DescIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/DescIterator#>;
331
•332 pub fn indexrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]index().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> usize;
333 /// Clone the pointer.
334 ///
335 /// # Safety
336 ///
337 /// The returned UniquePtr cannot outlive the cache.
338 unsafe fn uniquerust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]unique().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#>;
339 pub fn raw_nextrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]raw_next().(self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#>);
340 pub fn endrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]end().(self: &VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#) -> bool;
341 }
342 }