js-protocol 0.1.4

Generated Rust types and commands for the Chrome DevTools Protocol (js-protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;

/// Heap snapshot object id.

pub type HeapSnapshotObjectId<'a> = Cow<'a, str>;

/// Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingHeapProfileNode<'a> {
    /// Function location.
    #[serde(rename = "callFrame")]
    call_frame: crate::runtime::CallFrame<'a>,
    /// Allocations size in bytes for the node excluding children.
    #[serde(rename = "selfSize")]
    self_size: f64,
    /// Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
    id: u64,
    /// Child nodes.
    children: Vec<Box<SamplingHeapProfileNode<'a>>>,
}

impl<'a> SamplingHeapProfileNode<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `call_frame`: Function location.
    /// * `self_size`: Allocations size in bytes for the node excluding children.
    /// * `id`: Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
    /// * `children`: Child nodes.
    pub fn builder(call_frame: crate::runtime::CallFrame<'a>, self_size: f64, id: u64, children: Vec<Box<SamplingHeapProfileNode<'a>>>) -> SamplingHeapProfileNodeBuilder<'a> {
        SamplingHeapProfileNodeBuilder {
            call_frame: call_frame,
            self_size: self_size,
            id: id,
            children: children,
        }
    }
    /// Function location.
    pub fn call_frame(&self) -> &crate::runtime::CallFrame<'a> { &self.call_frame }
    /// Allocations size in bytes for the node excluding children.
    pub fn self_size(&self) -> f64 { self.self_size }
    /// Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
    pub fn id(&self) -> u64 { self.id }
    /// Child nodes.
    pub fn children(&self) -> &[Box<SamplingHeapProfileNode<'a>>] { &self.children }
}


pub struct SamplingHeapProfileNodeBuilder<'a> {
    call_frame: crate::runtime::CallFrame<'a>,
    self_size: f64,
    id: u64,
    children: Vec<Box<SamplingHeapProfileNode<'a>>>,
}

impl<'a> SamplingHeapProfileNodeBuilder<'a> {
    pub fn build(self) -> SamplingHeapProfileNode<'a> {
        SamplingHeapProfileNode {
            call_frame: self.call_frame,
            self_size: self.self_size,
            id: self.id,
            children: self.children,
        }
    }
}

/// A single sample from a sampling profile.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingHeapProfileSample {
    /// Allocation size in bytes attributed to the sample.
    size: f64,
    /// Id of the corresponding profile tree node.
    #[serde(rename = "nodeId")]
    node_id: u64,
    /// Time-ordered sample ordinal number. It is unique across all profiles retrieved
    /// between startSampling and stopSampling.
    ordinal: f64,
}

impl SamplingHeapProfileSample {
    /// Creates a builder for this type with the required parameters:
    /// * `size`: Allocation size in bytes attributed to the sample.
    /// * `node_id`: Id of the corresponding profile tree node.
    /// * `ordinal`: Time-ordered sample ordinal number. It is unique across all profiles retrieved between startSampling and stopSampling.
    pub fn builder(size: f64, node_id: u64, ordinal: f64) -> SamplingHeapProfileSampleBuilder {
        SamplingHeapProfileSampleBuilder {
            size: size,
            node_id: node_id,
            ordinal: ordinal,
        }
    }
    /// Allocation size in bytes attributed to the sample.
    pub fn size(&self) -> f64 { self.size }
    /// Id of the corresponding profile tree node.
    pub fn node_id(&self) -> u64 { self.node_id }
    /// Time-ordered sample ordinal number. It is unique across all profiles retrieved
    /// between startSampling and stopSampling.
    pub fn ordinal(&self) -> f64 { self.ordinal }
}


pub struct SamplingHeapProfileSampleBuilder {
    size: f64,
    node_id: u64,
    ordinal: f64,
}

impl SamplingHeapProfileSampleBuilder {
    pub fn build(self) -> SamplingHeapProfileSample {
        SamplingHeapProfileSample {
            size: self.size,
            node_id: self.node_id,
            ordinal: self.ordinal,
        }
    }
}

/// Sampling profile.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingHeapProfile<'a> {
    head: SamplingHeapProfileNode<'a>,
    samples: Vec<SamplingHeapProfileSample>,
}

impl<'a> SamplingHeapProfile<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `head`: 
    /// * `samples`: 
    pub fn builder(head: SamplingHeapProfileNode<'a>, samples: Vec<SamplingHeapProfileSample>) -> SamplingHeapProfileBuilder<'a> {
        SamplingHeapProfileBuilder {
            head: head,
            samples: samples,
        }
    }
    pub fn head(&self) -> &SamplingHeapProfileNode<'a> { &self.head }
    pub fn samples(&self) -> &[SamplingHeapProfileSample] { &self.samples }
}


pub struct SamplingHeapProfileBuilder<'a> {
    head: SamplingHeapProfileNode<'a>,
    samples: Vec<SamplingHeapProfileSample>,
}

impl<'a> SamplingHeapProfileBuilder<'a> {
    pub fn build(self) -> SamplingHeapProfile<'a> {
        SamplingHeapProfile {
            head: self.head,
            samples: self.samples,
        }
    }
}

/// Enables console to refer to the node with given id via $x (see Command Line API for more details
/// $x functions).

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AddInspectedHeapObjectParams<'a> {
    /// Heap snapshot object id to be accessible by means of $x command line API.
    #[serde(rename = "heapObjectId")]
    heap_object_id: HeapSnapshotObjectId<'a>,
}

impl<'a> AddInspectedHeapObjectParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `heap_object_id`: Heap snapshot object id to be accessible by means of $x command line API.
    pub fn builder(heap_object_id: impl Into<HeapSnapshotObjectId<'a>>) -> AddInspectedHeapObjectParamsBuilder<'a> {
        AddInspectedHeapObjectParamsBuilder {
            heap_object_id: heap_object_id.into(),
        }
    }
    /// Heap snapshot object id to be accessible by means of $x command line API.
    pub fn heap_object_id(&self) -> &HeapSnapshotObjectId<'a> { &self.heap_object_id }
}


pub struct AddInspectedHeapObjectParamsBuilder<'a> {
    heap_object_id: HeapSnapshotObjectId<'a>,
}

impl<'a> AddInspectedHeapObjectParamsBuilder<'a> {
    pub fn build(self) -> AddInspectedHeapObjectParams<'a> {
        AddInspectedHeapObjectParams {
            heap_object_id: self.heap_object_id,
        }
    }
}

impl<'a> AddInspectedHeapObjectParams<'a> { pub const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject"; }

impl<'a> crate::CdpCommand<'a> for AddInspectedHeapObjectParams<'a> {
    const METHOD: &'static str = "HeapProfiler.addInspectedHeapObject";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct CollectGarbageParams {}

impl CollectGarbageParams { pub const METHOD: &'static str = "HeapProfiler.collectGarbage"; }

impl<'a> crate::CdpCommand<'a> for CollectGarbageParams {
    const METHOD: &'static str = "HeapProfiler.collectGarbage";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}

impl DisableParams { pub const METHOD: &'static str = "HeapProfiler.disable"; }

impl<'a> crate::CdpCommand<'a> for DisableParams {
    const METHOD: &'static str = "HeapProfiler.disable";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}

impl EnableParams { pub const METHOD: &'static str = "HeapProfiler.enable"; }

impl<'a> crate::CdpCommand<'a> for EnableParams {
    const METHOD: &'static str = "HeapProfiler.enable";
    type Response = crate::EmptyReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHeapObjectIdParams<'a> {
    /// Identifier of the object to get heap object id for.
    #[serde(rename = "objectId")]
    object_id: crate::runtime::RemoteObjectId<'a>,
}

impl<'a> GetHeapObjectIdParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `object_id`: Identifier of the object to get heap object id for.
    pub fn builder(object_id: crate::runtime::RemoteObjectId<'a>) -> GetHeapObjectIdParamsBuilder<'a> {
        GetHeapObjectIdParamsBuilder {
            object_id: object_id,
        }
    }
    /// Identifier of the object to get heap object id for.
    pub fn object_id(&self) -> &crate::runtime::RemoteObjectId<'a> { &self.object_id }
}


pub struct GetHeapObjectIdParamsBuilder<'a> {
    object_id: crate::runtime::RemoteObjectId<'a>,
}

impl<'a> GetHeapObjectIdParamsBuilder<'a> {
    pub fn build(self) -> GetHeapObjectIdParams<'a> {
        GetHeapObjectIdParams {
            object_id: self.object_id,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHeapObjectIdReturns<'a> {
    /// Id of the heap snapshot object corresponding to the passed remote object id.
    #[serde(rename = "heapSnapshotObjectId")]
    heap_snapshot_object_id: HeapSnapshotObjectId<'a>,
}

impl<'a> GetHeapObjectIdReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `heap_snapshot_object_id`: Id of the heap snapshot object corresponding to the passed remote object id.
    pub fn builder(heap_snapshot_object_id: impl Into<HeapSnapshotObjectId<'a>>) -> GetHeapObjectIdReturnsBuilder<'a> {
        GetHeapObjectIdReturnsBuilder {
            heap_snapshot_object_id: heap_snapshot_object_id.into(),
        }
    }
    /// Id of the heap snapshot object corresponding to the passed remote object id.
    pub fn heap_snapshot_object_id(&self) -> &HeapSnapshotObjectId<'a> { &self.heap_snapshot_object_id }
}


pub struct GetHeapObjectIdReturnsBuilder<'a> {
    heap_snapshot_object_id: HeapSnapshotObjectId<'a>,
}

impl<'a> GetHeapObjectIdReturnsBuilder<'a> {
    pub fn build(self) -> GetHeapObjectIdReturns<'a> {
        GetHeapObjectIdReturns {
            heap_snapshot_object_id: self.heap_snapshot_object_id,
        }
    }
}

impl<'a> GetHeapObjectIdParams<'a> { pub const METHOD: &'static str = "HeapProfiler.getHeapObjectId"; }

impl<'a> crate::CdpCommand<'a> for GetHeapObjectIdParams<'a> {
    const METHOD: &'static str = "HeapProfiler.getHeapObjectId";
    type Response = GetHeapObjectIdReturns<'a>;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetObjectByHeapObjectIdParams<'a> {
    #[serde(rename = "objectId")]
    object_id: HeapSnapshotObjectId<'a>,
    /// Symbolic group name that can be used to release multiple objects.
    #[serde(skip_serializing_if = "Option::is_none", rename = "objectGroup")]
    object_group: Option<Cow<'a, str>>,
}

impl<'a> GetObjectByHeapObjectIdParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `object_id`: 
    pub fn builder(object_id: impl Into<HeapSnapshotObjectId<'a>>) -> GetObjectByHeapObjectIdParamsBuilder<'a> {
        GetObjectByHeapObjectIdParamsBuilder {
            object_id: object_id.into(),
            object_group: None,
        }
    }
    pub fn object_id(&self) -> &HeapSnapshotObjectId<'a> { &self.object_id }
    /// Symbolic group name that can be used to release multiple objects.
    pub fn object_group(&self) -> Option<&str> { self.object_group.as_deref() }
}


pub struct GetObjectByHeapObjectIdParamsBuilder<'a> {
    object_id: HeapSnapshotObjectId<'a>,
    object_group: Option<Cow<'a, str>>,
}

impl<'a> GetObjectByHeapObjectIdParamsBuilder<'a> {
    /// Symbolic group name that can be used to release multiple objects.
    pub fn object_group(mut self, object_group: impl Into<Cow<'a, str>>) -> Self { self.object_group = Some(object_group.into()); self }
    pub fn build(self) -> GetObjectByHeapObjectIdParams<'a> {
        GetObjectByHeapObjectIdParams {
            object_id: self.object_id,
            object_group: self.object_group,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetObjectByHeapObjectIdReturns<'a> {
    /// Evaluation result.
    result: crate::runtime::RemoteObject<'a>,
}

impl<'a> GetObjectByHeapObjectIdReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `result`: Evaluation result.
    pub fn builder(result: crate::runtime::RemoteObject<'a>) -> GetObjectByHeapObjectIdReturnsBuilder<'a> {
        GetObjectByHeapObjectIdReturnsBuilder {
            result: result,
        }
    }
    /// Evaluation result.
    pub fn result(&self) -> &crate::runtime::RemoteObject<'a> { &self.result }
}


pub struct GetObjectByHeapObjectIdReturnsBuilder<'a> {
    result: crate::runtime::RemoteObject<'a>,
}

impl<'a> GetObjectByHeapObjectIdReturnsBuilder<'a> {
    pub fn build(self) -> GetObjectByHeapObjectIdReturns<'a> {
        GetObjectByHeapObjectIdReturns {
            result: self.result,
        }
    }
}

impl<'a> GetObjectByHeapObjectIdParams<'a> { pub const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId"; }

impl<'a> crate::CdpCommand<'a> for GetObjectByHeapObjectIdParams<'a> {
    const METHOD: &'static str = "HeapProfiler.getObjectByHeapObjectId";
    type Response = GetObjectByHeapObjectIdReturns<'a>;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetSamplingProfileReturns<'a> {
    /// Return the sampling profile being collected.
    profile: SamplingHeapProfile<'a>,
}

impl<'a> GetSamplingProfileReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `profile`: Return the sampling profile being collected.
    pub fn builder(profile: SamplingHeapProfile<'a>) -> GetSamplingProfileReturnsBuilder<'a> {
        GetSamplingProfileReturnsBuilder {
            profile: profile,
        }
    }
    /// Return the sampling profile being collected.
    pub fn profile(&self) -> &SamplingHeapProfile<'a> { &self.profile }
}


pub struct GetSamplingProfileReturnsBuilder<'a> {
    profile: SamplingHeapProfile<'a>,
}

impl<'a> GetSamplingProfileReturnsBuilder<'a> {
    pub fn build(self) -> GetSamplingProfileReturns<'a> {
        GetSamplingProfileReturns {
            profile: self.profile,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetSamplingProfileParams {}

impl GetSamplingProfileParams { pub const METHOD: &'static str = "HeapProfiler.getSamplingProfile"; }

impl<'a> crate::CdpCommand<'a> for GetSamplingProfileParams {
    const METHOD: &'static str = "HeapProfiler.getSamplingProfile";
    type Response = GetSamplingProfileReturns<'a>;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartSamplingParams {
    /// Average sample interval in bytes. Poisson distribution is used for the intervals. The
    /// default value is 32768 bytes.
    #[serde(skip_serializing_if = "Option::is_none", rename = "samplingInterval")]
    sampling_interval: Option<f64>,
    /// Maximum stack depth. The default value is 128.
    #[serde(skip_serializing_if = "Option::is_none", rename = "stackDepth")]
    stack_depth: Option<f64>,
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// major GC, which will show which functions cause large temporary memory
    /// usage or long GC pauses.
    #[serde(skip_serializing_if = "Option::is_none", rename = "includeObjectsCollectedByMajorGC")]
    include_objects_collected_by_major_gc: Option<bool>,
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// minor GC, which is useful when tuning a latency-sensitive application
    /// for minimal GC activity.
    #[serde(skip_serializing_if = "Option::is_none", rename = "includeObjectsCollectedByMinorGC")]
    include_objects_collected_by_minor_gc: Option<bool>,
}

impl StartSamplingParams {
    /// Creates a builder for this type.
    pub fn builder() -> StartSamplingParamsBuilder {
        StartSamplingParamsBuilder {
            sampling_interval: None,
            stack_depth: None,
            include_objects_collected_by_major_gc: None,
            include_objects_collected_by_minor_gc: None,
        }
    }
    /// Average sample interval in bytes. Poisson distribution is used for the intervals. The
    /// default value is 32768 bytes.
    pub fn sampling_interval(&self) -> Option<f64> { self.sampling_interval }
    /// Maximum stack depth. The default value is 128.
    pub fn stack_depth(&self) -> Option<f64> { self.stack_depth }
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// major GC, which will show which functions cause large temporary memory
    /// usage or long GC pauses.
    pub fn include_objects_collected_by_major_gc(&self) -> Option<bool> { self.include_objects_collected_by_major_gc }
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// minor GC, which is useful when tuning a latency-sensitive application
    /// for minimal GC activity.
    pub fn include_objects_collected_by_minor_gc(&self) -> Option<bool> { self.include_objects_collected_by_minor_gc }
}

#[derive(Default)]
pub struct StartSamplingParamsBuilder {
    sampling_interval: Option<f64>,
    stack_depth: Option<f64>,
    include_objects_collected_by_major_gc: Option<bool>,
    include_objects_collected_by_minor_gc: Option<bool>,
}

impl StartSamplingParamsBuilder {
    /// Average sample interval in bytes. Poisson distribution is used for the intervals. The
    /// default value is 32768 bytes.
    pub fn sampling_interval(mut self, sampling_interval: f64) -> Self { self.sampling_interval = Some(sampling_interval); self }
    /// Maximum stack depth. The default value is 128.
    pub fn stack_depth(mut self, stack_depth: f64) -> Self { self.stack_depth = Some(stack_depth); self }
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// major GC, which will show which functions cause large temporary memory
    /// usage or long GC pauses.
    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 }
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// minor GC, which is useful when tuning a latency-sensitive application
    /// for minimal GC activity.
    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 }
    pub fn build(self) -> StartSamplingParams {
        StartSamplingParams {
            sampling_interval: self.sampling_interval,
            stack_depth: self.stack_depth,
            include_objects_collected_by_major_gc: self.include_objects_collected_by_major_gc,
            include_objects_collected_by_minor_gc: self.include_objects_collected_by_minor_gc,
        }
    }
}

impl StartSamplingParams { pub const METHOD: &'static str = "HeapProfiler.startSampling"; }

impl<'a> crate::CdpCommand<'a> for StartSamplingParams {
    const METHOD: &'static str = "HeapProfiler.startSampling";
    type Response = crate::EmptyReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartTrackingHeapObjectsParams {
    #[serde(skip_serializing_if = "Option::is_none", rename = "trackAllocations")]
    track_allocations: Option<bool>,
}

impl StartTrackingHeapObjectsParams {
    /// Creates a builder for this type.
    pub fn builder() -> StartTrackingHeapObjectsParamsBuilder {
        StartTrackingHeapObjectsParamsBuilder {
            track_allocations: None,
        }
    }
    pub fn track_allocations(&self) -> Option<bool> { self.track_allocations }
}

#[derive(Default)]
pub struct StartTrackingHeapObjectsParamsBuilder {
    track_allocations: Option<bool>,
}

impl StartTrackingHeapObjectsParamsBuilder {
    pub fn track_allocations(mut self, track_allocations: bool) -> Self { self.track_allocations = Some(track_allocations); self }
    pub fn build(self) -> StartTrackingHeapObjectsParams {
        StartTrackingHeapObjectsParams {
            track_allocations: self.track_allocations,
        }
    }
}

impl StartTrackingHeapObjectsParams { pub const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects"; }

impl<'a> crate::CdpCommand<'a> for StartTrackingHeapObjectsParams {
    const METHOD: &'static str = "HeapProfiler.startTrackingHeapObjects";
    type Response = crate::EmptyReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StopSamplingReturns<'a> {
    /// Recorded sampling heap profile.
    profile: SamplingHeapProfile<'a>,
}

impl<'a> StopSamplingReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `profile`: Recorded sampling heap profile.
    pub fn builder(profile: SamplingHeapProfile<'a>) -> StopSamplingReturnsBuilder<'a> {
        StopSamplingReturnsBuilder {
            profile: profile,
        }
    }
    /// Recorded sampling heap profile.
    pub fn profile(&self) -> &SamplingHeapProfile<'a> { &self.profile }
}


pub struct StopSamplingReturnsBuilder<'a> {
    profile: SamplingHeapProfile<'a>,
}

impl<'a> StopSamplingReturnsBuilder<'a> {
    pub fn build(self) -> StopSamplingReturns<'a> {
        StopSamplingReturns {
            profile: self.profile,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct StopSamplingParams {}

impl StopSamplingParams { pub const METHOD: &'static str = "HeapProfiler.stopSampling"; }

impl<'a> crate::CdpCommand<'a> for StopSamplingParams {
    const METHOD: &'static str = "HeapProfiler.stopSampling";
    type Response = StopSamplingReturns<'a>;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StopTrackingHeapObjectsParams {
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken
    /// when the tracking is stopped.
    #[serde(skip_serializing_if = "Option::is_none", rename = "reportProgress")]
    report_progress: Option<bool>,
    /// Deprecated in favor of 'exposeInternals'.
    #[serde(skip_serializing_if = "Option::is_none", rename = "treatGlobalObjectsAsRoots")]
    treat_global_objects_as_roots: Option<bool>,
    /// If true, numerical values are included in the snapshot
    #[serde(skip_serializing_if = "Option::is_none", rename = "captureNumericValue")]
    capture_numeric_value: Option<bool>,
    /// If true, exposes internals of the snapshot.
    #[serde(skip_serializing_if = "Option::is_none", rename = "exposeInternals")]
    expose_internals: Option<bool>,
}

impl StopTrackingHeapObjectsParams {
    /// Creates a builder for this type.
    pub fn builder() -> StopTrackingHeapObjectsParamsBuilder {
        StopTrackingHeapObjectsParamsBuilder {
            report_progress: None,
            treat_global_objects_as_roots: None,
            capture_numeric_value: None,
            expose_internals: None,
        }
    }
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken
    /// when the tracking is stopped.
    pub fn report_progress(&self) -> Option<bool> { self.report_progress }
    /// Deprecated in favor of 'exposeInternals'.
    pub fn treat_global_objects_as_roots(&self) -> Option<bool> { self.treat_global_objects_as_roots }
    /// If true, numerical values are included in the snapshot
    pub fn capture_numeric_value(&self) -> Option<bool> { self.capture_numeric_value }
    /// If true, exposes internals of the snapshot.
    pub fn expose_internals(&self) -> Option<bool> { self.expose_internals }
}

#[derive(Default)]
pub struct StopTrackingHeapObjectsParamsBuilder {
    report_progress: Option<bool>,
    treat_global_objects_as_roots: Option<bool>,
    capture_numeric_value: Option<bool>,
    expose_internals: Option<bool>,
}

impl StopTrackingHeapObjectsParamsBuilder {
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken
    /// when the tracking is stopped.
    pub fn report_progress(mut self, report_progress: bool) -> Self { self.report_progress = Some(report_progress); self }
    /// Deprecated in favor of 'exposeInternals'.
    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 }
    /// If true, numerical values are included in the snapshot
    pub fn capture_numeric_value(mut self, capture_numeric_value: bool) -> Self { self.capture_numeric_value = Some(capture_numeric_value); self }
    /// If true, exposes internals of the snapshot.
    pub fn expose_internals(mut self, expose_internals: bool) -> Self { self.expose_internals = Some(expose_internals); self }
    pub fn build(self) -> StopTrackingHeapObjectsParams {
        StopTrackingHeapObjectsParams {
            report_progress: self.report_progress,
            treat_global_objects_as_roots: self.treat_global_objects_as_roots,
            capture_numeric_value: self.capture_numeric_value,
            expose_internals: self.expose_internals,
        }
    }
}

impl StopTrackingHeapObjectsParams { pub const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects"; }

impl<'a> crate::CdpCommand<'a> for StopTrackingHeapObjectsParams {
    const METHOD: &'static str = "HeapProfiler.stopTrackingHeapObjects";
    type Response = crate::EmptyReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TakeHeapSnapshotParams {
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
    #[serde(skip_serializing_if = "Option::is_none", rename = "reportProgress")]
    report_progress: Option<bool>,
    /// If true, a raw snapshot without artificial roots will be generated.
    /// Deprecated in favor of 'exposeInternals'.
    #[serde(skip_serializing_if = "Option::is_none", rename = "treatGlobalObjectsAsRoots")]
    treat_global_objects_as_roots: Option<bool>,
    /// If true, numerical values are included in the snapshot
    #[serde(skip_serializing_if = "Option::is_none", rename = "captureNumericValue")]
    capture_numeric_value: Option<bool>,
    /// If true, exposes internals of the snapshot.
    #[serde(skip_serializing_if = "Option::is_none", rename = "exposeInternals")]
    expose_internals: Option<bool>,
}

impl TakeHeapSnapshotParams {
    /// Creates a builder for this type.
    pub fn builder() -> TakeHeapSnapshotParamsBuilder {
        TakeHeapSnapshotParamsBuilder {
            report_progress: None,
            treat_global_objects_as_roots: None,
            capture_numeric_value: None,
            expose_internals: None,
        }
    }
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
    pub fn report_progress(&self) -> Option<bool> { self.report_progress }
    /// If true, a raw snapshot without artificial roots will be generated.
    /// Deprecated in favor of 'exposeInternals'.
    pub fn treat_global_objects_as_roots(&self) -> Option<bool> { self.treat_global_objects_as_roots }
    /// If true, numerical values are included in the snapshot
    pub fn capture_numeric_value(&self) -> Option<bool> { self.capture_numeric_value }
    /// If true, exposes internals of the snapshot.
    pub fn expose_internals(&self) -> Option<bool> { self.expose_internals }
}

#[derive(Default)]
pub struct TakeHeapSnapshotParamsBuilder {
    report_progress: Option<bool>,
    treat_global_objects_as_roots: Option<bool>,
    capture_numeric_value: Option<bool>,
    expose_internals: Option<bool>,
}

impl TakeHeapSnapshotParamsBuilder {
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
    pub fn report_progress(mut self, report_progress: bool) -> Self { self.report_progress = Some(report_progress); self }
    /// If true, a raw snapshot without artificial roots will be generated.
    /// Deprecated in favor of 'exposeInternals'.
    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 }
    /// If true, numerical values are included in the snapshot
    pub fn capture_numeric_value(mut self, capture_numeric_value: bool) -> Self { self.capture_numeric_value = Some(capture_numeric_value); self }
    /// If true, exposes internals of the snapshot.
    pub fn expose_internals(mut self, expose_internals: bool) -> Self { self.expose_internals = Some(expose_internals); self }
    pub fn build(self) -> TakeHeapSnapshotParams {
        TakeHeapSnapshotParams {
            report_progress: self.report_progress,
            treat_global_objects_as_roots: self.treat_global_objects_as_roots,
            capture_numeric_value: self.capture_numeric_value,
            expose_internals: self.expose_internals,
        }
    }
}

impl TakeHeapSnapshotParams { pub const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot"; }

impl<'a> crate::CdpCommand<'a> for TakeHeapSnapshotParams {
    const METHOD: &'static str = "HeapProfiler.takeHeapSnapshot";
    type Response = crate::EmptyReturns;
}