rustenium_cdp_definitions/browser_protocol/memory/
command_builders.rs1use super::commands::*;
2#[derive(Debug, Clone, Default)]
3pub struct GetDomCountersBuilder;
4impl GetDomCountersBuilder {
5 pub fn new() -> Self {
6 Self
7 }
8 pub fn build(self) -> GetDomCounters {
9 GetDomCounters {
10 method: GetDomCountersMethod::GetDomCounters,
11 params: GetDomCountersParams {},
12 }
13 }
14}
15impl GetDomCounters {
16 pub fn builder() -> GetDomCountersBuilder {
17 GetDomCountersBuilder
18 }
19}
20#[derive(Debug, Clone, Default)]
21pub struct GetDomCountersForLeakDetectionBuilder;
22impl GetDomCountersForLeakDetectionBuilder {
23 pub fn new() -> Self {
24 Self
25 }
26 pub fn build(self) -> GetDomCountersForLeakDetection {
27 GetDomCountersForLeakDetection {
28 method: GetDomCountersForLeakDetectionMethod::GetDomCountersForLeakDetection,
29 params: GetDomCountersForLeakDetectionParams {},
30 }
31 }
32}
33impl GetDomCountersForLeakDetection {
34 pub fn builder() -> GetDomCountersForLeakDetectionBuilder {
35 GetDomCountersForLeakDetectionBuilder
36 }
37}
38#[derive(Debug, Clone, Default)]
39pub struct PrepareForLeakDetectionBuilder;
40impl PrepareForLeakDetectionBuilder {
41 pub fn new() -> Self {
42 Self
43 }
44 pub fn build(self) -> PrepareForLeakDetection {
45 PrepareForLeakDetection {
46 method: PrepareForLeakDetectionMethod::PrepareForLeakDetection,
47 params: PrepareForLeakDetectionParams {},
48 }
49 }
50}
51impl PrepareForLeakDetection {
52 pub fn builder() -> PrepareForLeakDetectionBuilder {
53 PrepareForLeakDetectionBuilder
54 }
55}
56#[derive(Debug, Clone, Default)]
57pub struct ForciblyPurgeJavaScriptMemoryBuilder;
58impl ForciblyPurgeJavaScriptMemoryBuilder {
59 pub fn new() -> Self {
60 Self
61 }
62 pub fn build(self) -> ForciblyPurgeJavaScriptMemory {
63 ForciblyPurgeJavaScriptMemory {
64 method: ForciblyPurgeJavaScriptMemoryMethod::ForciblyPurgeJavaScriptMemory,
65 params: ForciblyPurgeJavaScriptMemoryParams {},
66 }
67 }
68}
69impl ForciblyPurgeJavaScriptMemory {
70 pub fn builder() -> ForciblyPurgeJavaScriptMemoryBuilder {
71 ForciblyPurgeJavaScriptMemoryBuilder
72 }
73}
74impl SetPressureNotificationsSuppressed {
75 pub fn builder() -> SetPressureNotificationsSuppressedBuilder {
76 <SetPressureNotificationsSuppressedBuilder as Default>::default()
77 }
78}
79#[derive(Default, Clone)]
80pub struct SetPressureNotificationsSuppressedBuilder {
81 suppressed: Option<bool>,
82}
83impl SetPressureNotificationsSuppressedBuilder {
84 pub fn suppressed(mut self, suppressed: impl Into<bool>) -> Self {
85 self.suppressed = Some(suppressed.into());
86 self
87 }
88 pub fn build(self) -> Result<SetPressureNotificationsSuppressed, String> {
89 Ok(SetPressureNotificationsSuppressed {
90 method: SetPressureNotificationsSuppressedMethod::SetPressureNotificationsSuppressed,
91 params: SetPressureNotificationsSuppressedParams {
92 suppressed: self.suppressed.ok_or_else(|| {
93 format!("Field `{}` is mandatory.", std::stringify!(suppressed))
94 })?,
95 },
96 })
97 }
98}
99impl SimulatePressureNotification {
100 pub fn builder() -> SimulatePressureNotificationBuilder {
101 <SimulatePressureNotificationBuilder as Default>::default()
102 }
103}
104#[derive(Default, Clone)]
105pub struct SimulatePressureNotificationBuilder {
106 level: Option<super::types::PressureLevel>,
107}
108impl SimulatePressureNotificationBuilder {
109 pub fn level(mut self, level: impl Into<super::types::PressureLevel>) -> Self {
110 self.level = Some(level.into());
111 self
112 }
113 pub fn build(self) -> Result<SimulatePressureNotification, String> {
114 Ok(SimulatePressureNotification {
115 method: SimulatePressureNotificationMethod::SimulatePressureNotification,
116 params: SimulatePressureNotificationParams {
117 level: self
118 .level
119 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(level)))?,
120 },
121 })
122 }
123}
124impl StartSampling {
125 pub fn builder() -> StartSamplingBuilder {
126 <StartSamplingBuilder as Default>::default()
127 }
128}
129#[derive(Default, Clone)]
130pub struct StartSamplingBuilder {
131 sampling_interval: Option<i64>,
132 suppress_randomness: Option<bool>,
133}
134impl StartSamplingBuilder {
135 pub fn sampling_interval(mut self, sampling_interval: impl Into<i64>) -> Self {
136 self.sampling_interval = Some(sampling_interval.into());
137 self
138 }
139 pub fn suppress_randomness(mut self, suppress_randomness: impl Into<bool>) -> Self {
140 self.suppress_randomness = Some(suppress_randomness.into());
141 self
142 }
143 pub fn build(self) -> StartSampling {
144 StartSampling {
145 method: StartSamplingMethod::StartSampling,
146 params: StartSamplingParams {
147 sampling_interval: self.sampling_interval,
148 suppress_randomness: self.suppress_randomness,
149 },
150 }
151 }
152}
153#[derive(Debug, Clone, Default)]
154pub struct StopSamplingBuilder;
155impl StopSamplingBuilder {
156 pub fn new() -> Self {
157 Self
158 }
159 pub fn build(self) -> StopSampling {
160 StopSampling {
161 method: StopSamplingMethod::StopSampling,
162 params: StopSamplingParams {},
163 }
164 }
165}
166impl StopSampling {
167 pub fn builder() -> StopSamplingBuilder {
168 StopSamplingBuilder
169 }
170}
171#[derive(Debug, Clone, Default)]
172pub struct GetAllTimeSamplingProfileBuilder;
173impl GetAllTimeSamplingProfileBuilder {
174 pub fn new() -> Self {
175 Self
176 }
177 pub fn build(self) -> GetAllTimeSamplingProfile {
178 GetAllTimeSamplingProfile {
179 method: GetAllTimeSamplingProfileMethod::GetAllTimeSamplingProfile,
180 params: GetAllTimeSamplingProfileParams {},
181 }
182 }
183}
184impl GetAllTimeSamplingProfile {
185 pub fn builder() -> GetAllTimeSamplingProfileBuilder {
186 GetAllTimeSamplingProfileBuilder
187 }
188}
189#[derive(Debug, Clone, Default)]
190pub struct GetBrowserSamplingProfileBuilder;
191impl GetBrowserSamplingProfileBuilder {
192 pub fn new() -> Self {
193 Self
194 }
195 pub fn build(self) -> GetBrowserSamplingProfile {
196 GetBrowserSamplingProfile {
197 method: GetBrowserSamplingProfileMethod::GetBrowserSamplingProfile,
198 params: GetBrowserSamplingProfileParams {},
199 }
200 }
201}
202impl GetBrowserSamplingProfile {
203 pub fn builder() -> GetBrowserSamplingProfileBuilder {
204 GetBrowserSamplingProfileBuilder
205 }
206}
207#[derive(Debug, Clone, Default)]
208pub struct GetSamplingProfileBuilder;
209impl GetSamplingProfileBuilder {
210 pub fn new() -> Self {
211 Self
212 }
213 pub fn build(self) -> GetSamplingProfile {
214 GetSamplingProfile {
215 method: GetSamplingProfileMethod::GetSamplingProfile,
216 params: GetSamplingProfileParams {},
217 }
218 }
219}
220impl GetSamplingProfile {
221 pub fn builder() -> GetSamplingProfileBuilder {
222 GetSamplingProfileBuilder
223 }
224}