winget_types/installer/switches/
mod.rs1mod custom;
2mod install_location;
3mod interactive;
4mod log;
5mod repair;
6mod silent;
7mod silent_with_progress;
8mod switch;
9mod upgrade;
10
11use bon::Builder;
12
13pub use super::switches::{
14 custom::CustomSwitch, install_location::InstallLocationSwitch, interactive::InteractiveSwitch,
15 log::LogSwitch, repair::RepairSwitch, silent::SilentSwitch,
16 silent_with_progress::SilentWithProgressSwitch, upgrade::UpgradeSwitch,
17};
18
19#[derive(Builder, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
20#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
21#[cfg_attr(feature = "serde", serde(rename_all = "PascalCase"))]
22pub struct InstallerSwitches {
23 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
27 pub(crate) silent: Option<SilentSwitch>,
28
29 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
35 pub(crate) silent_with_progress: Option<SilentWithProgressSwitch>,
36
37 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
42 pub(crate) interactive: Option<InteractiveSwitch>,
43
44 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
50 pub(crate) install_location: Option<InstallLocationSwitch>,
51
52 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
58 pub(crate) log: Option<LogSwitch>,
59
60 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
63 pub(crate) upgrade: Option<UpgradeSwitch>,
64
65 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
68 pub(crate) custom: Option<CustomSwitch>,
69
70 #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
75 pub(crate) repair: Option<RepairSwitch>,
76}
77
78impl InstallerSwitches {
79 #[must_use]
81 #[inline]
82 pub const fn silent(&self) -> Option<&SilentSwitch> {
83 self.silent.as_ref()
84 }
85
86 #[must_use]
88 #[inline]
89 pub const fn silent_with_progress(&self) -> Option<&SilentWithProgressSwitch> {
90 self.silent_with_progress.as_ref()
91 }
92
93 #[must_use]
95 #[inline]
96 pub const fn interactive(&self) -> Option<&InteractiveSwitch> {
97 self.interactive.as_ref()
98 }
99
100 #[must_use]
102 #[inline]
103 pub const fn log(&self) -> Option<&LogSwitch> {
104 self.log.as_ref()
105 }
106
107 #[must_use]
109 #[inline]
110 pub const fn upgrade(&self) -> Option<&UpgradeSwitch> {
111 self.upgrade.as_ref()
112 }
113
114 #[must_use]
116 #[inline]
117 pub const fn custom(&self) -> Option<&CustomSwitch> {
118 self.custom.as_ref()
119 }
120
121 #[must_use]
123 #[inline]
124 pub const fn repair(&self) -> Option<&RepairSwitch> {
125 self.repair.as_ref()
126 }
127
128 #[must_use]
142 pub const fn is_empty(&self) -> bool {
143 self.silent.is_none()
144 && self.silent_with_progress.is_none()
145 && self.interactive.is_none()
146 && self.install_location.is_none()
147 && self.log.is_none()
148 && self.upgrade.is_none()
149 && self.custom.is_none()
150 && self.repair.is_none()
151 }
152}
153
154impl Default for InstallerSwitches {
155 fn default() -> Self {
156 Self::builder().build()
157 }
158}