Debian Codegraph @

src/iterators/dependency.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/::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#;
3 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/;
4
5 use cxxrust-analyzer cargo cxx 1.0.199 crate/::UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#;
6
7 use craterust-analyzer cargo rust-apt 0.8.0 crate/::rawrust-analyzer cargo rust-apt 0.8.0 raw/::{DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#, VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#};
8 use craterust-analyzer cargo rust-apt 0.8.0 crate/::{Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#, Packagerust-analyzer cargo rust-apt 0.8.0 iterators/package/Package#, Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#};
9
10 /// DepFlags defined in depcache.h
11 #[allow(non_upper_case_globals, non_snake_case)]
12 pub mod DepFlagsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/ {
13 pub const DepNowrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/DepNow.: u8 = 1;
14 pub const DepInstallrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/DepInstall.: u8 = 2;
15 pub const DepCVerrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/DepCVer.: u8 = 4;
16 pub const DepGNowrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/DepGNow.: u8 = 8;
17 pub const DepGInstallrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/DepGInstall.: u8 = 16;
18 pub const DepGVerrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepFlags/DepGVer.: u8 = 32;
19 }
20
21 /// The different types of Dependencies.
22 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
23 pub enum DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType# {
24 Dependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Depends# = 1,
25 PreDependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#PreDepends# = 2,
26 Suggestsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Suggests# = 3,
27 Recommendsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Recommends# = 4,
28 Conflictsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Conflicts# = 5,
29 Replacesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Replaces# = 6,
30 Obsoletesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Obsoletes# = 7,
31 DpkgBreaksrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#DpkgBreaks# = 8,
32 Enhancesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Enhances# = 9,
33 }
34
35 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<u8> for DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType# {
36 fn fromrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][`From<u8>`]from().(value: u8) -> Selfrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][`From<u8>`] {
37 match value {
38 1 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Dependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Depends#,
39 2 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::PreDependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#PreDepends#,
40 3 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Suggestsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Suggests#,
41 4 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Recommendsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Recommends#,
42 5 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Conflictsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Conflicts#,
43 6 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Replacesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Replaces#,
44 7 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Obsoletesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Obsoletes#,
45 8 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::DpkgBreaksrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#DpkgBreaks#,
46 9 => DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Enhancesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Enhances#,
47 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Dependency is malformed?"),
48 }
49 }
50 }
51
52 impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str> for DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType# {
53 fn as_refrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][`AsRef<str>`]as_ref().(&self) -> &str {
54 match self {
55 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Dependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Depends# => "Depends",
56 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::PreDependsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#PreDepends# => "PreDepends",
57 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Suggestsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Suggests# => "Suggests",
58 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Recommendsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Recommends# => "Recommends",
59 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Conflictsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Conflicts# => "Conflicts",
60 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Replacesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Replaces# => "Replaces",
61 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Obsoletesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Obsoletes# => "Obsoletes",
62 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::DpkgBreaksrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#DpkgBreaks# => "Breaks",
63 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::Enhancesrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#Enhances# => "Enhances",
64 }
65 }
66 }
67
68 impl 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 DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType# {
69 fn fmtrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][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# { writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.as_refrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][`AsRef<str>`]as_ref().()) }
70 }
71
72 /// A struct representing a Base Dependency.
73 pub struct BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#<'a> {
74 pub ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#ptr.: UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#>,
75 cacherust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#cache.: &'a Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#,
76 targetrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#target.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<Packagerust-analyzer cargo rust-apt 0.8.0 iterators/package/Package#<'a>>,
77 parent_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#parent_ver.: OnceCellrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/OnceCell#<UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#>>,
78 }
79
80 impl<'a> BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#<'a> {
81 pub fn newrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]new().(ptr: UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#>, cache: &'a Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#) -> BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep# {
82 BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep# {
83 ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#ptr.,
84 cacherust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#cache.,
85 targetrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#target.: 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().(),
86 parent_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#parent_ver.: 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().(),
87 }
88 }
89
90 /// This is the name of the dependency.
91 pub fn namerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]name().(&self) -> &str { self.target_packagerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]target_package().().namerust-analyzer cargo rust-apt 0.8.0 iterators/package/raw/impl#[PkgIterator]name().() }
92
93 /// Return the target package.
94 ///
95 /// For Reverse Dependencies this will actually return the parent package
96 pub fn target_packagerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]target_package().(&self) -> &Packagerust-analyzer cargo rust-apt 0.8.0 iterators/package/Package#<'a> {
97 self.targetrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#target..get_or_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get_or_init().(|| {
98 if self.is_reverserust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]is_reverse().() {
99 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/dependency/BaseDep#cache., unsafe { self.parent_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]parent_pkg().() })
100 } else {
101 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/dependency/BaseDep#cache., unsafe { self.target_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]target_pkg().() })
102 }
103 })
104 }
105
106 /// The target version &str of the dependency if specified.
107 pub fn versionrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]version().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
108 if self.is_reverserust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]is_reverse().() {
109 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(
110 self.parent_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#parent_ver.
111 .get_or_initrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cell/once/impl#[`OnceCell<T>`]get_or_init().(|| unsafe { self.parent_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]parent_ver().() })
112 .versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]version().(),
113 )
114 } else {
115 self.target_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]target_ver().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()
116 }
117 }
118
119 /// The Dependency Type. Depends, Recommends, etc.
120 pub fn dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]dep_type().(&self) -> DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType# { DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::fromrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][`From<u8>`]from().(self.ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#ptr..dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]dep_type().()) }
121
122 /// Comparison type of the dependency version, if specified.
123 pub fn comp_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]comp_type().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> { self.ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#ptr..comp_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]comp_type().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() }
124
125 // Iterate all Versions that are able to satisfy this dependency
126 pub fn all_targetsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]all_targets().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#> {
127 unsafe {
128 self.ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#ptr.
129 .all_targetsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]all_targets().()
130 .iterrust-analyzer cargo cxx 1.0.199 cxx_vector/impl#[`CxxVector<T>`]iter().()
131 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| Versionrust-analyzer cargo rust-apt 0.8.0 iterators/version/Version#::newrust-analyzer cargo rust-apt 0.8.0 iterators/version/impl#[`Version<'a>`]new().(v.uniquerust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/impl#[VerIterator]unique().(), self.cacherust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#cache.))
132 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
133 }
134 }
135 }
136
137 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 BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#<'a> {
138 fn fmtrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'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# {
139 if let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(comp), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(version)) = (self.comp_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]comp_type().(), self.versionrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]version().()) {
140 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "({} {comp} {version})", self.namerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]name().())
141 } else {
142 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "({})", self.namerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]name().())
143 }
144 }
145 }
146
147 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 BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#<'a> {
148 fn fmtrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'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# {
149 f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("BaseDep")
150 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("parent", unsafe { &self.parent_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]parent_pkg().().namerust-analyzer cargo rust-apt 0.8.0 iterators/package/raw/impl#[PkgIterator]name().() })
151 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("name", &self.namerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]name().())
152 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("comp", &self.comp_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]comp_type().())
153 .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/dependency/impl#[`BaseDep<'a>`]version().())
154 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("dep_type", &self.dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]dep_type().())
155 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("is_reverse", &self.is_reverserust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]is_reverse().())
156 .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().()
157 }
158 }
159
160 /// A struct representing a single Dependency record.
161 ///
162 /// This can contain multiple Base Dependencies that can
163 /// satisfy the same Dependency.
164 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(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/macros/Debug:)]
165 pub struct Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a> {
166 pub(craterust-analyzer cargo rust-apt 0.8.0 crate/) ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#ptr.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#<'a>>,
167 }
168
169 impl<'a> Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a> {
170 /// Return the Dep Type of this group. Depends, Pre-Depends.
171 pub fn dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`Dependency<'a>`]dep_type().(&self) -> DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType# { self[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]dep_type().() }
172
173 /// Returns True if there are multiple dependencies that can satisfy this
174 pub fn is_orrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`Dependency<'a>`]is_or().(&self) -> bool { self.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().1 }
175
176 /// Returns a reference to the first BaseDep
177 pub fn firstrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`Dependency<'a>`]first().(&self) -> &BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#<'a> { &self[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). }
178 }
179
180 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 Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#<'a> {
181 fn fmtrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`Dependency<'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# {
182 let mut dep_str = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
183
184 for (i, base_dep) in self.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
185 dep_str rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&base_dep.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
186 if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().self.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() {
187 dep_str rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign().+=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign()." | "
188 }
189 }
190
191 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(
192 f,
193 "{} {:?} {dep_str}",
194 unsafe { self.firstrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`Dependency<'a>`]first().().parent_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]parent_pkg().().fullnamerust-analyzer cargo rust-apt 0.8.0 iterators/package/raw/impl#[PkgIterator]fullname().(false) },
195 self.dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`Dependency<'a>`]dep_type().(),
196 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
197 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
198 }
199 }
200
201 pub fn create_depends_maprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/create_depends_map().(
202 cache: &Cacherust-analyzer cargo rust-apt 0.8.0 cache/Cache#,
203 dep: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#>>,
204 ) -> 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#>> {
205 let mut dependencies: 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#>> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().();
206
207 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mut dep) = dep {
208 while !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dep.endrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]end().() {
209 let mut or_deps = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
210 or_deps.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#::newrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]new().(unsafe { dep.uniquerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]unique().() }, cache));
211
212 // This means that more than one thing can satisfy a dependency.
213 // For reverse dependencies we cannot get the or deps.
214 // This can cause a segfault
215 // See: https://gitlab.com/volian/rust-apt/-/merge_requests/36
216 if dep.or_deprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]or_dep().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dep.is_reverserust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]is_reverse().() {
217 loop {
218 dep.pin_mutrust-analyzer cargo cxx 1.0.199 unique_ptr/impl#[`UniquePtr<T>`]pin_mut().().raw_nextrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]raw_next().();
219 or_deps.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(BaseDeprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/BaseDep#::newrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[`BaseDep<'a>`]new().(unsafe { dep.uniquerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]unique().() }, cache));
220 // This is the last of the Or group
221 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dep.or_deprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]or_dep().() {
222 break;
223 }
224 }
225 }
226
227 let dep_type = DepTyperust-analyzer cargo rust-apt 0.8.0 iterators/dependency/DepType#::fromrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/impl#[DepType][`From<u8>`]from().(dep.dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]dep_type().());
228
229 // If the entry already exists in the map append it.
230 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vec) = dependencies.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(&dep_type) {
231 vec.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency# { ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#ptr.: or_deps })
232 } else {
233 // Doesn't exist so we create it
234 dependencies.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(dep_type, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Dependencyrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency# { ptrrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/Dependency#ptr.: or_deps }]);
235 }
236 dep.pin_mutrust-analyzer cargo cxx 1.0.199 unique_ptr/impl#[`UniquePtr<T>`]pin_mut().().raw_nextrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]raw_next().();
237 }
238 }
239 dependencies
240 }
241
242 #[cxxrust-analyzer cargo cxx 1.0.199 crate/::bridgerust-analyzer cargo cxxbridge-macro 1.0.199 bridge:]
243 pub(craterust-analyzer cargo rust-apt 0.8.0 crate/) mod rawrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/ {
244 unsafe extern "C++" {
245 includerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include!!("rust-apt/apt-pkg-c/package.h");
246
247 type DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#;
248
249 type PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/PkgIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::rawrust-analyzer cargo rust-apt 0.8.0 raw/::PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/package/raw/PkgIterator#;
250 type VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/VerIterator# = craterust-analyzer cargo rust-apt 0.8.0 crate/::rawrust-analyzer cargo rust-apt 0.8.0 raw/::VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/version/raw/VerIterator#;
251
252 /// The Parent PkgIterator for this dependency
253 ///
254 /// # Safety
255 ///
256 /// If the inner pointer is null segfaults can occur.
257 ///
258 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
259 /// is recommended.
260 ///
261 /// The returned UniquePtr cannot outlive the cache.
262 unsafe fn parent_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]parent_pkg().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/PkgIterator#>;
263
264 /// The Parent VerIterator for this dependency
265 ///
266 /// # Safety
267 ///
268 /// If the inner pointer is null segfaults can occur.
269 ///
270 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
271 /// is recommended.
272 ///
273 /// The returned UniquePtr cannot outlive the cache.
274 unsafe fn parent_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]parent_ver().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/VerIterator#>;
275
276 // Dependency Declarations
277 /// String representation of the dependency compare type
278 /// "","<=",">=","<",">","=","!="
279 ///
280 /// This returns Error for no compare type.
281 pub fn comp_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]comp_type().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&str>;
282
283 // Get the dependency type as a u8
284 // You can use `DepType::from(raw_dep.dep_type())` to convert to enum.
285 pub fn dep_typerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]dep_type().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> u8;
286
287 /// Returns true if the dependency type is critical.
288 ///
289 /// Depends, PreDepends, Conflicts, Obsoletes, Breaks
290 /// will return [true].
291 ///
292 /// Suggests, Recommends, Replaces and Enhances
293 /// will return [false].
294 #[cxx_name = "IsCritical"]
295 pub fn is_criticalrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]is_critical().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> bool;
296
297 /// Return True if the dep is reverse, false if normal
298 #[cxx_name = "Reverse"]
299 pub fn is_reverserust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]is_reverse().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> bool;
300
301 pub fn target_verrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]target_ver().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<&str>;
302
303 /// Return the Target Package for the dependency.
304 ///
305 /// # Safety
306 ///
307 /// If the inner pointer is null segfaults can occur.
308 ///
309 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
310 /// is recommended.
311 ///
312 /// The returned UniquePtr cannot outlive the cache.
313 unsafe fn target_pkgrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]target_pkg().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<PkgIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/PkgIterator#>;
314
315 /// Returns a CxxVector of VerIterators.
316 ///
317 /// # Safety
318 ///
319 /// These can not be owned and will need to be Cloned with unique.
320 ///
321 /// If the inner pointer is null segfaults can occur.
322 ///
323 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
324 /// is recommended.
325 ///
326 /// The returned UniquePtr cannot outlive the cache.
327 unsafe fn all_targetsrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]all_targets().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<CxxVectorrust-analyzer cargo cxx 1.0.199 cxx_vector/CxxVector#<VerIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/VerIterator#>>;
328
329 /// Return true if this dep is Or'd with the next. The last dep in the
330 /// or group will return False.
331 pub fn or_deprust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]or_dep().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> bool;
332
•333 pub fn indexrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]index().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> usize;
334 /// Clone the pointer.
335 ///
336 /// # Safety
337 ///
338 /// If the inner pointer is null segfaults can occur.
339 ///
340 /// Using [`crate::raw::IntoRawIter::make_safe`] to convert to an Option
341 /// is recommended.
342 ///
343 /// The returned UniquePtr cannot outlive the cache.
344 unsafe fn uniquerust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]unique().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#>;
345 pub fn raw_nextrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]raw_next().(self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#>);
346 pub fn endrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/impl#[DepIterator]end().(self: &DepIteratorrust-analyzer cargo rust-apt 0.8.0 iterators/dependency/raw/DepIterator#) -> bool;
347 }
348 }