1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5pub type HeapSnapshotObjectId<'a> = Cow<'a, str>;
8
9#[derive(Debug, Clone, Serialize, Deserialize, Default)]
12#[serde(rename_all = "camelCase")]
13pub struct SamplingHeapProfileNode<'a> {
14 #[serde(rename = "callFrame")]
16 call_frame: crate::runtime::CallFrame<'a>,
17 #[serde(rename = "selfSize")]
19 self_size: f64,
20 id: u64,
22 children: Vec<Box<SamplingHeapProfileNode<'a>>>,
24}
25
26impl<'a> SamplingHeapProfileNode<'a> {
27 pub fn builder(call_frame: crate::runtime::CallFrame<'a>, self_size: f64, id: u64, children: Vec<Box<SamplingHeapProfileNode<'a>>>) -> SamplingHeapProfileNodeBuilder<'a> {
33 SamplingHeapProfileNodeBuilder {
34 call_frame: call_frame,
35 self_size: self_size,
36 id: id,
37 children: children,
38 }
39 }
40 pub fn call_frame(&self) -> &crate::runtime::CallFrame<'a> { &self.call_frame }
42 pub fn self_size(&self) -> f64 { self.self_size }
44 pub fn id(&self) -> u64 { self.id }
46 pub fn children(&self) -> &[Box<SamplingHeapProfileNode<'a>>] { &self.children }
48}
49
50
51pub struct SamplingHeapProfileNodeBuilder<'a> {
52 call_frame: crate::runtime::CallFrame<'a>,
53 self_size: f64,
54 id: u64,
55 children: Vec<Box<SamplingHeapProfileNode<'a>>>,
56}
57
58impl<'a> SamplingHeapProfileNodeBuilder<'a> {
59 pub fn build(self) -> SamplingHeapProfileNode<'a> {
60 SamplingHeapProfileNode {
61 call_frame: self.call_frame,
62 self_size: self.self_size,
63 id: self.id,
64 children: self.children,
65 }
66 }
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize, Default)]
72#[serde(rename_all = "camelCase")]
73pub struct SamplingHeapProfileSample {
74 size: f64,
76 #[serde(rename = "nodeId")]
78 node_id: u64,
79 ordinal: f64,
82}
83
84impl SamplingHeapProfileSample {
85 pub fn builder(size: f64, node_id: u64, ordinal: f64) -> SamplingHeapProfileSampleBuilder {
90 SamplingHeapProfileSampleBuilder {
91 size: size,
92 node_id: node_id,
93 ordinal: ordinal,
94 }
95 }
96 pub fn size(&self) -> f64 { self.size }
98 pub fn node_id(&self) -> u64 { self.node_id }
100 pub fn ordinal(&self) -> f64 { self.ordinal }
103}
104
105
106pub struct SamplingHeapProfileSampleBuilder {
107 size: f64,
108 node_id: u64,
109 ordinal: f64,
110}
111
112impl SamplingHeapProfileSampleBuilder {
113 pub fn build(self) -> SamplingHeapProfileSample {
114 SamplingHeapProfileSample {
115 size: self.size,
116 node_id: self.node_id,
117 ordinal: self.ordinal,
118 }
119 }
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize, Default)]
125#[serde(rename_all = "camelCase")]
126pub struct SamplingHeapProfile<'a> {
127 head: SamplingHeapProfileNode<'a>,
128 samples: Vec<SamplingHeapProfileSample>,
129}
130
131impl<'a> SamplingHeapProfile<'a> {
132 pub fn builder(head: SamplingHeapProfileNode<'a>, samples: Vec<SamplingHeapProfileSample>) -> SamplingHeapProfileBuilder<'a> {
136 SamplingHeapProfileBuilder {
137 head: head,
138 samples: samples,
139 }
140 }
141 pub fn head(&self) -> &SamplingHeapProfileNode<'a> { &self.head }
142 pub fn samples(&self) -> &[SamplingHeapProfileSample] { &self.samples }
143}
144
145
146pub struct SamplingHeapProfileBuilder<'a> {
147 head: SamplingHeapProfileNode<'a>,
148 samples: Vec<SamplingHeapProfileSample>,
149}
150
151impl<'a> SamplingHeapProfileBuilder<'a> {
152 pub fn build(self) -> SamplingHeapProfile<'a> {
153 SamplingHeapProfile {
154 head: self.head,
155 samples: self.samples,
156 }
157 }
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize, Default)]
164#[serde(rename_all = "camelCase")]
165pub struct AddInspectedHeapObjectParams<'a> {
166 #[serde(rename = "heapObjectId")]
168 heap_object_id: HeapSnapshotObjectId<'a>,
169}
170
171impl<'a> AddInspectedHeapObjectParams<'a> {
172 pub fn builder(heap_object_id: impl Into<HeapSnapshotObjectId<'a>>) -> AddInspectedHeapObjectParamsBuilder<'a> {
175 AddInspectedHeapObjectParamsBuilder {
176 heap_object_id: heap_object_id.into(),
177 }
178 }
179 pub fn heap_object_id(&self) -> &HeapSnapshotObjectId<'a> { &self.heap_object_id }
181}
182
183
184pub struct AddInspectedHeapObjectParamsBuilder<'a> {
185 heap_object_id: HeapSnapshotObjectId<'a>,
186}
187
188impl<'a> AddInspectedHeapObjectParamsBuilder<'a> {
189 pub fn build(self) -> AddInspectedHeapObjectParams<'a> {
190 AddInspectedHeapObjectParams {
191 heap_object_id: self.heap_object_id,
192 }
193 }
194}
195
196impl<'a> AddInspectedHeapObjectParams<'a> { pub const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject"; }
197
198impl<'a> crate::CdpCommand<'a> for AddInspectedHeapObjectParams<'a> {
199 const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject";
200 type Response = crate::EmptyReturns;
201}
202
203#[derive(Debug, Clone, Serialize, Deserialize, Default)]
204pub struct CollectGarbageParams {}
205
206impl CollectGarbageParams { pub const METHOD: &'static str = "HeapProfiler.collectGarbage"; }
207
208impl<'a> crate::CdpCommand<'a> for CollectGarbageParams {
209 const METHOD: &'static str = "HeapProfiler.collectGarbage";
210 type Response = crate::EmptyReturns;
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize, Default)]
214pub struct DisableParams {}
215
216impl DisableParams { pub const METHOD: &'static str = "HeapProfiler.disable"; }
217
218impl<'a> crate::CdpCommand<'a> for DisableParams {
219 const METHOD: &'static str = "HeapProfiler.disable";
220 type Response = crate::EmptyReturns;
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize, Default)]
224pub struct EnableParams {}
225
226impl EnableParams { pub const METHOD: &'static str = "HeapProfiler.enable"; }
227
228impl<'a> crate::CdpCommand<'a> for EnableParams {
229 const METHOD: &'static str = "HeapProfiler.enable";
230 type Response = crate::EmptyReturns;
231}
232
233
234#[derive(Debug, Clone, Serialize, Deserialize, Default)]
235#[serde(rename_all = "camelCase")]
236pub struct GetHeapObjectIdParams<'a> {
237 #[serde(rename = "objectId")]
239 object_id: crate::runtime::RemoteObjectId<'a>,
240}
241
242impl<'a> GetHeapObjectIdParams<'a> {
243 pub fn builder(object_id: crate::runtime::RemoteObjectId<'a>) -> GetHeapObjectIdParamsBuilder<'a> {
246 GetHeapObjectIdParamsBuilder {
247 object_id: object_id,
248 }
249 }
250 pub fn object_id(&self) -> &crate::runtime::RemoteObjectId<'a> { &self.object_id }
252}
253
254
255pub struct GetHeapObjectIdParamsBuilder<'a> {
256 object_id: crate::runtime::RemoteObjectId<'a>,
257}
258
259impl<'a> GetHeapObjectIdParamsBuilder<'a> {
260 pub fn build(self) -> GetHeapObjectIdParams<'a> {
261 GetHeapObjectIdParams {
262 object_id: self.object_id,
263 }
264 }
265}
266
267
268#[derive(Debug, Clone, Serialize, Deserialize, Default)]
269#[serde(rename_all = "camelCase")]
270pub struct GetHeapObjectIdReturns<'a> {
271 #[serde(rename = "heapSnapshotObjectId")]
273 heap_snapshot_object_id: HeapSnapshotObjectId<'a>,
274}
275
276impl<'a> GetHeapObjectIdReturns<'a> {
277 pub fn builder(heap_snapshot_object_id: impl Into<HeapSnapshotObjectId<'a>>) -> GetHeapObjectIdReturnsBuilder<'a> {
280 GetHeapObjectIdReturnsBuilder {
281 heap_snapshot_object_id: heap_snapshot_object_id.into(),
282 }
283 }
284 pub fn heap_snapshot_object_id(&self) -> &HeapSnapshotObjectId<'a> { &self.heap_snapshot_object_id }
286}
287
288
289pub struct GetHeapObjectIdReturnsBuilder<'a> {
290 heap_snapshot_object_id: HeapSnapshotObjectId<'a>,
291}
292
293impl<'a> GetHeapObjectIdReturnsBuilder<'a> {
294 pub fn build(self) -> GetHeapObjectIdReturns<'a> {
295 GetHeapObjectIdReturns {
296 heap_snapshot_object_id: self.heap_snapshot_object_id,
297 }
298 }
299}
300
301impl<'a> GetHeapObjectIdParams<'a> { pub const METHOD: &'static str = "HeapProfiler.getHeapObjectId"; }
302
303impl<'a> crate::CdpCommand<'a> for GetHeapObjectIdParams<'a> {
304 const METHOD: &'static str = "HeapProfiler.getHeapObjectId";
305 type Response = GetHeapObjectIdReturns<'a>;
306}
307
308
309#[derive(Debug, Clone, Serialize, Deserialize, Default)]
310#[serde(rename_all = "camelCase")]
311pub struct GetObjectByHeapObjectIdParams<'a> {
312 #[serde(rename = "objectId")]
313 object_id: HeapSnapshotObjectId<'a>,
314 #[serde(skip_serializing_if = "Option::is_none", rename = "objectGroup")]
316 object_group: Option<Cow<'a, str>>,
317}
318
319impl<'a> GetObjectByHeapObjectIdParams<'a> {
320 pub fn builder(object_id: impl Into<HeapSnapshotObjectId<'a>>) -> GetObjectByHeapObjectIdParamsBuilder<'a> {
323 GetObjectByHeapObjectIdParamsBuilder {
324 object_id: object_id.into(),
325 object_group: None,
326 }
327 }
328 pub fn object_id(&self) -> &HeapSnapshotObjectId<'a> { &self.object_id }
329 pub fn object_group(&self) -> Option<&str> { self.object_group.as_deref() }
331}
332
333
334pub struct GetObjectByHeapObjectIdParamsBuilder<'a> {
335 object_id: HeapSnapshotObjectId<'a>,
336 object_group: Option<Cow<'a, str>>,
337}
338
339impl<'a> GetObjectByHeapObjectIdParamsBuilder<'a> {
340 pub fn object_group(mut self, object_group: impl Into<Cow<'a, str>>) -> Self { self.object_group = Some(object_group.into()); self }
342 pub fn build(self) -> GetObjectByHeapObjectIdParams<'a> {
343 GetObjectByHeapObjectIdParams {
344 object_id: self.object_id,
345 object_group: self.object_group,
346 }
347 }
348}
349
350
351#[derive(Debug, Clone, Serialize, Deserialize, Default)]
352#[serde(rename_all = "camelCase")]
353pub struct GetObjectByHeapObjectIdReturns<'a> {
354 result: crate::runtime::RemoteObject<'a>,
356}
357
358impl<'a> GetObjectByHeapObjectIdReturns<'a> {
359 pub fn builder(result: crate::runtime::RemoteObject<'a>) -> GetObjectByHeapObjectIdReturnsBuilder<'a> {
362 GetObjectByHeapObjectIdReturnsBuilder {
363 result: result,
364 }
365 }
366 pub fn result(&self) -> &crate::runtime::RemoteObject<'a> { &self.result }
368}
369
370
371pub struct GetObjectByHeapObjectIdReturnsBuilder<'a> {
372 result: crate::runtime::RemoteObject<'a>,
373}
374
375impl<'a> GetObjectByHeapObjectIdReturnsBuilder<'a> {
376 pub fn build(self) -> GetObjectByHeapObjectIdReturns<'a> {
377 GetObjectByHeapObjectIdReturns {
378 result: self.result,
379 }
380 }
381}
382
383impl<'a> GetObjectByHeapObjectIdParams<'a> { pub const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId"; }
384
385impl<'a> crate::CdpCommand<'a> for GetObjectByHeapObjectIdParams<'a> {
386 const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId";
387 type Response = GetObjectByHeapObjectIdReturns<'a>;
388}
389
390
391#[derive(Debug, Clone, Serialize, Deserialize, Default)]
392#[serde(rename_all = "camelCase")]
393pub struct GetSamplingProfileReturns<'a> {
394 profile: SamplingHeapProfile<'a>,
396}
397
398impl<'a> GetSamplingProfileReturns<'a> {
399 pub fn builder(profile: SamplingHeapProfile<'a>) -> GetSamplingProfileReturnsBuilder<'a> {
402 GetSamplingProfileReturnsBuilder {
403 profile: profile,
404 }
405 }
406 pub fn profile(&self) -> &SamplingHeapProfile<'a> { &self.profile }
408}
409
410
411pub struct GetSamplingProfileReturnsBuilder<'a> {
412 profile: SamplingHeapProfile<'a>,
413}
414
415impl<'a> GetSamplingProfileReturnsBuilder<'a> {
416 pub fn build(self) -> GetSamplingProfileReturns<'a> {
417 GetSamplingProfileReturns {
418 profile: self.profile,
419 }
420 }
421}
422
423#[derive(Debug, Clone, Serialize, Deserialize, Default)]
424pub struct GetSamplingProfileParams {}
425
426impl GetSamplingProfileParams { pub const METHOD: &'static str = "HeapProfiler.getSamplingProfile"; }
427
428impl<'a> crate::CdpCommand<'a> for GetSamplingProfileParams {
429 const METHOD: &'static str = "HeapProfiler.getSamplingProfile";
430 type Response = GetSamplingProfileReturns<'a>;
431}
432
433
434#[derive(Debug, Clone, Serialize, Deserialize, Default)]
435#[serde(rename_all = "camelCase")]
436pub struct StartSamplingParams {
437 #[serde(skip_serializing_if = "Option::is_none", rename = "samplingInterval")]
440 sampling_interval: Option<f64>,
441 #[serde(skip_serializing_if = "Option::is_none", rename = "stackDepth")]
443 stack_depth: Option<f64>,
444 #[serde(skip_serializing_if = "Option::is_none", rename = "includeObjectsCollectedByMajorGC")]
452 include_objects_collected_by_major_gc: Option<bool>,
453 #[serde(skip_serializing_if = "Option::is_none", rename = "includeObjectsCollectedByMinorGC")]
461 include_objects_collected_by_minor_gc: Option<bool>,
462}
463
464impl StartSamplingParams {
465 pub fn builder() -> StartSamplingParamsBuilder {
467 StartSamplingParamsBuilder {
468 sampling_interval: None,
469 stack_depth: None,
470 include_objects_collected_by_major_gc: None,
471 include_objects_collected_by_minor_gc: None,
472 }
473 }
474 pub fn sampling_interval(&self) -> Option<f64> { self.sampling_interval }
477 pub fn stack_depth(&self) -> Option<f64> { self.stack_depth }
479 pub fn include_objects_collected_by_major_gc(&self) -> Option<bool> { self.include_objects_collected_by_major_gc }
487 pub fn include_objects_collected_by_minor_gc(&self) -> Option<bool> { self.include_objects_collected_by_minor_gc }
495}
496
497#[derive(Default)]
498pub struct StartSamplingParamsBuilder {
499 sampling_interval: Option<f64>,
500 stack_depth: Option<f64>,
501 include_objects_collected_by_major_gc: Option<bool>,
502 include_objects_collected_by_minor_gc: Option<bool>,
503}
504
505impl StartSamplingParamsBuilder {
506 pub fn sampling_interval(mut self, sampling_interval: f64) -> Self { self.sampling_interval = Some(sampling_interval); self }
509 pub fn stack_depth(mut self, stack_depth: f64) -> Self { self.stack_depth = Some(stack_depth); self }
511 pub fn include_objects_collected_by_major_gc(mut self, include_objects_collected_by_major_gc: bool) -> Self { self.include_objects_collected_by_major_gc = Some(include_objects_collected_by_major_gc); self }
519 pub fn include_objects_collected_by_minor_gc(mut self, include_objects_collected_by_minor_gc: bool) -> Self { self.include_objects_collected_by_minor_gc = Some(include_objects_collected_by_minor_gc); self }
527 pub fn build(self) -> StartSamplingParams {
528 StartSamplingParams {
529 sampling_interval: self.sampling_interval,
530 stack_depth: self.stack_depth,
531 include_objects_collected_by_major_gc: self.include_objects_collected_by_major_gc,
532 include_objects_collected_by_minor_gc: self.include_objects_collected_by_minor_gc,
533 }
534 }
535}
536
537impl StartSamplingParams { pub const METHOD: &'static str = "HeapProfiler.startSampling"; }
538
539impl<'a> crate::CdpCommand<'a> for StartSamplingParams {
540 const METHOD: &'static str = "HeapProfiler.startSampling";
541 type Response = crate::EmptyReturns;
542}
543
544
545#[derive(Debug, Clone, Serialize, Deserialize, Default)]
546#[serde(rename_all = "camelCase")]
547pub struct StartTrackingHeapObjectsParams {
548 #[serde(skip_serializing_if = "Option::is_none", rename = "trackAllocations")]
549 track_allocations: Option<bool>,
550}
551
552impl StartTrackingHeapObjectsParams {
553 pub fn builder() -> StartTrackingHeapObjectsParamsBuilder {
555 StartTrackingHeapObjectsParamsBuilder {
556 track_allocations: None,
557 }
558 }
559 pub fn track_allocations(&self) -> Option<bool> { self.track_allocations }
560}
561
562#[derive(Default)]
563pub struct StartTrackingHeapObjectsParamsBuilder {
564 track_allocations: Option<bool>,
565}
566
567impl StartTrackingHeapObjectsParamsBuilder {
568 pub fn track_allocations(mut self, track_allocations: bool) -> Self { self.track_allocations = Some(track_allocations); self }
569 pub fn build(self) -> StartTrackingHeapObjectsParams {
570 StartTrackingHeapObjectsParams {
571 track_allocations: self.track_allocations,
572 }
573 }
574}
575
576impl StartTrackingHeapObjectsParams { pub const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects"; }
577
578impl<'a> crate::CdpCommand<'a> for StartTrackingHeapObjectsParams {
579 const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects";
580 type Response = crate::EmptyReturns;
581}
582
583
584#[derive(Debug, Clone, Serialize, Deserialize, Default)]
585#[serde(rename_all = "camelCase")]
586pub struct StopSamplingReturns<'a> {
587 profile: SamplingHeapProfile<'a>,
589}
590
591impl<'a> StopSamplingReturns<'a> {
592 pub fn builder(profile: SamplingHeapProfile<'a>) -> StopSamplingReturnsBuilder<'a> {
595 StopSamplingReturnsBuilder {
596 profile: profile,
597 }
598 }
599 pub fn profile(&self) -> &SamplingHeapProfile<'a> { &self.profile }
601}
602
603
604pub struct StopSamplingReturnsBuilder<'a> {
605 profile: SamplingHeapProfile<'a>,
606}
607
608impl<'a> StopSamplingReturnsBuilder<'a> {
609 pub fn build(self) -> StopSamplingReturns<'a> {
610 StopSamplingReturns {
611 profile: self.profile,
612 }
613 }
614}
615
616#[derive(Debug, Clone, Serialize, Deserialize, Default)]
617pub struct StopSamplingParams {}
618
619impl StopSamplingParams { pub const METHOD: &'static str = "HeapProfiler.stopSampling"; }
620
621impl<'a> crate::CdpCommand<'a> for StopSamplingParams {
622 const METHOD: &'static str = "HeapProfiler.stopSampling";
623 type Response = StopSamplingReturns<'a>;
624}
625
626
627#[derive(Debug, Clone, Serialize, Deserialize, Default)]
628#[serde(rename_all = "camelCase")]
629pub struct StopTrackingHeapObjectsParams {
630 #[serde(skip_serializing_if = "Option::is_none", rename = "reportProgress")]
633 report_progress: Option<bool>,
634 #[serde(skip_serializing_if = "Option::is_none", rename = "treatGlobalObjectsAsRoots")]
636 treat_global_objects_as_roots: Option<bool>,
637 #[serde(skip_serializing_if = "Option::is_none", rename = "captureNumericValue")]
639 capture_numeric_value: Option<bool>,
640 #[serde(skip_serializing_if = "Option::is_none", rename = "exposeInternals")]
642 expose_internals: Option<bool>,
643}
644
645impl StopTrackingHeapObjectsParams {
646 pub fn builder() -> StopTrackingHeapObjectsParamsBuilder {
648 StopTrackingHeapObjectsParamsBuilder {
649 report_progress: None,
650 treat_global_objects_as_roots: None,
651 capture_numeric_value: None,
652 expose_internals: None,
653 }
654 }
655 pub fn report_progress(&self) -> Option<bool> { self.report_progress }
658 pub fn treat_global_objects_as_roots(&self) -> Option<bool> { self.treat_global_objects_as_roots }
660 pub fn capture_numeric_value(&self) -> Option<bool> { self.capture_numeric_value }
662 pub fn expose_internals(&self) -> Option<bool> { self.expose_internals }
664}
665
666#[derive(Default)]
667pub struct StopTrackingHeapObjectsParamsBuilder {
668 report_progress: Option<bool>,
669 treat_global_objects_as_roots: Option<bool>,
670 capture_numeric_value: Option<bool>,
671 expose_internals: Option<bool>,
672}
673
674impl StopTrackingHeapObjectsParamsBuilder {
675 pub fn report_progress(mut self, report_progress: bool) -> Self { self.report_progress = Some(report_progress); self }
678 pub fn treat_global_objects_as_roots(mut self, treat_global_objects_as_roots: bool) -> Self { self.treat_global_objects_as_roots = Some(treat_global_objects_as_roots); self }
680 pub fn capture_numeric_value(mut self, capture_numeric_value: bool) -> Self { self.capture_numeric_value = Some(capture_numeric_value); self }
682 pub fn expose_internals(mut self, expose_internals: bool) -> Self { self.expose_internals = Some(expose_internals); self }
684 pub fn build(self) -> StopTrackingHeapObjectsParams {
685 StopTrackingHeapObjectsParams {
686 report_progress: self.report_progress,
687 treat_global_objects_as_roots: self.treat_global_objects_as_roots,
688 capture_numeric_value: self.capture_numeric_value,
689 expose_internals: self.expose_internals,
690 }
691 }
692}
693
694impl StopTrackingHeapObjectsParams { pub const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects"; }
695
696impl<'a> crate::CdpCommand<'a> for StopTrackingHeapObjectsParams {
697 const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects";
698 type Response = crate::EmptyReturns;
699}
700
701
702#[derive(Debug, Clone, Serialize, Deserialize, Default)]
703#[serde(rename_all = "camelCase")]
704pub struct TakeHeapSnapshotParams {
705 #[serde(skip_serializing_if = "Option::is_none", rename = "reportProgress")]
707 report_progress: Option<bool>,
708 #[serde(skip_serializing_if = "Option::is_none", rename = "treatGlobalObjectsAsRoots")]
711 treat_global_objects_as_roots: Option<bool>,
712 #[serde(skip_serializing_if = "Option::is_none", rename = "captureNumericValue")]
714 capture_numeric_value: Option<bool>,
715 #[serde(skip_serializing_if = "Option::is_none", rename = "exposeInternals")]
717 expose_internals: Option<bool>,
718}
719
720impl TakeHeapSnapshotParams {
721 pub fn builder() -> TakeHeapSnapshotParamsBuilder {
723 TakeHeapSnapshotParamsBuilder {
724 report_progress: None,
725 treat_global_objects_as_roots: None,
726 capture_numeric_value: None,
727 expose_internals: None,
728 }
729 }
730 pub fn report_progress(&self) -> Option<bool> { self.report_progress }
732 pub fn treat_global_objects_as_roots(&self) -> Option<bool> { self.treat_global_objects_as_roots }
735 pub fn capture_numeric_value(&self) -> Option<bool> { self.capture_numeric_value }
737 pub fn expose_internals(&self) -> Option<bool> { self.expose_internals }
739}
740
741#[derive(Default)]
742pub struct TakeHeapSnapshotParamsBuilder {
743 report_progress: Option<bool>,
744 treat_global_objects_as_roots: Option<bool>,
745 capture_numeric_value: Option<bool>,
746 expose_internals: Option<bool>,
747}
748
749impl TakeHeapSnapshotParamsBuilder {
750 pub fn report_progress(mut self, report_progress: bool) -> Self { self.report_progress = Some(report_progress); self }
752 pub fn treat_global_objects_as_roots(mut self, treat_global_objects_as_roots: bool) -> Self { self.treat_global_objects_as_roots = Some(treat_global_objects_as_roots); self }
755 pub fn capture_numeric_value(mut self, capture_numeric_value: bool) -> Self { self.capture_numeric_value = Some(capture_numeric_value); self }
757 pub fn expose_internals(mut self, expose_internals: bool) -> Self { self.expose_internals = Some(expose_internals); self }
759 pub fn build(self) -> TakeHeapSnapshotParams {
760 TakeHeapSnapshotParams {
761 report_progress: self.report_progress,
762 treat_global_objects_as_roots: self.treat_global_objects_as_roots,
763 capture_numeric_value: self.capture_numeric_value,
764 expose_internals: self.expose_internals,
765 }
766 }
767}
768
769impl TakeHeapSnapshotParams { pub const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot"; }
770
771impl<'a> crate::CdpCommand<'a> for TakeHeapSnapshotParams {
772 const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot";
773 type Response = crate::EmptyReturns;
774}