1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5pub type LayerId<'a> = Cow<'a, str>;
8
9pub type SnapshotId<'a> = Cow<'a, str>;
12
13#[derive(Debug, Clone, Serialize, Deserialize, Default)]
16#[serde(rename_all = "camelCase")]
17pub struct ScrollRect<'a> {
18 rect: crate::dom::Rect,
20 #[serde(rename = "type")]
22 type_: Cow<'a, str>,
23}
24
25impl<'a> ScrollRect<'a> {
26 pub fn builder(rect: crate::dom::Rect, type_: impl Into<Cow<'a, str>>) -> ScrollRectBuilder<'a> {
27 ScrollRectBuilder {
28 rect: rect,
29 type_: type_.into(),
30 }
31 }
32 pub fn rect(&self) -> &crate::dom::Rect { &self.rect }
33 pub fn type_(&self) -> &str { self.type_.as_ref() }
34}
35
36
37pub struct ScrollRectBuilder<'a> {
38 rect: crate::dom::Rect,
39 type_: Cow<'a, str>,
40}
41
42impl<'a> ScrollRectBuilder<'a> {
43 pub fn build(self) -> ScrollRect<'a> {
44 ScrollRect {
45 rect: self.rect,
46 type_: self.type_,
47 }
48 }
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize, Default)]
54#[serde(rename_all = "camelCase")]
55pub struct StickyPositionConstraint<'a> {
56 stickyBoxRect: crate::dom::Rect,
58 containingBlockRect: crate::dom::Rect,
60 #[serde(skip_serializing_if = "Option::is_none")]
62 nearestLayerShiftingStickyBox: Option<LayerId<'a>>,
63 #[serde(skip_serializing_if = "Option::is_none")]
65 nearestLayerShiftingContainingBlock: Option<LayerId<'a>>,
66}
67
68impl<'a> StickyPositionConstraint<'a> {
69 pub fn builder(stickyBoxRect: crate::dom::Rect, containingBlockRect: crate::dom::Rect) -> StickyPositionConstraintBuilder<'a> {
70 StickyPositionConstraintBuilder {
71 stickyBoxRect: stickyBoxRect,
72 containingBlockRect: containingBlockRect,
73 nearestLayerShiftingStickyBox: None,
74 nearestLayerShiftingContainingBlock: None,
75 }
76 }
77 pub fn stickyBoxRect(&self) -> &crate::dom::Rect { &self.stickyBoxRect }
78 pub fn containingBlockRect(&self) -> &crate::dom::Rect { &self.containingBlockRect }
79 pub fn nearestLayerShiftingStickyBox(&self) -> Option<&LayerId<'a>> { self.nearestLayerShiftingStickyBox.as_ref() }
80 pub fn nearestLayerShiftingContainingBlock(&self) -> Option<&LayerId<'a>> { self.nearestLayerShiftingContainingBlock.as_ref() }
81}
82
83
84pub struct StickyPositionConstraintBuilder<'a> {
85 stickyBoxRect: crate::dom::Rect,
86 containingBlockRect: crate::dom::Rect,
87 nearestLayerShiftingStickyBox: Option<LayerId<'a>>,
88 nearestLayerShiftingContainingBlock: Option<LayerId<'a>>,
89}
90
91impl<'a> StickyPositionConstraintBuilder<'a> {
92 pub fn nearestLayerShiftingStickyBox(mut self, nearestLayerShiftingStickyBox: LayerId<'a>) -> Self { self.nearestLayerShiftingStickyBox = Some(nearestLayerShiftingStickyBox); self }
94 pub fn nearestLayerShiftingContainingBlock(mut self, nearestLayerShiftingContainingBlock: LayerId<'a>) -> Self { self.nearestLayerShiftingContainingBlock = Some(nearestLayerShiftingContainingBlock); self }
96 pub fn build(self) -> StickyPositionConstraint<'a> {
97 StickyPositionConstraint {
98 stickyBoxRect: self.stickyBoxRect,
99 containingBlockRect: self.containingBlockRect,
100 nearestLayerShiftingStickyBox: self.nearestLayerShiftingStickyBox,
101 nearestLayerShiftingContainingBlock: self.nearestLayerShiftingContainingBlock,
102 }
103 }
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize, Default)]
109#[serde(rename_all = "camelCase")]
110pub struct PictureTile<'a> {
111 x: f64,
113 y: f64,
115 picture: Cow<'a, str>,
117}
118
119impl<'a> PictureTile<'a> {
120 pub fn builder(x: f64, y: f64, picture: impl Into<Cow<'a, str>>) -> PictureTileBuilder<'a> {
121 PictureTileBuilder {
122 x: x,
123 y: y,
124 picture: picture.into(),
125 }
126 }
127 pub fn x(&self) -> f64 { self.x }
128 pub fn y(&self) -> f64 { self.y }
129 pub fn picture(&self) -> &str { self.picture.as_ref() }
130}
131
132
133pub struct PictureTileBuilder<'a> {
134 x: f64,
135 y: f64,
136 picture: Cow<'a, str>,
137}
138
139impl<'a> PictureTileBuilder<'a> {
140 pub fn build(self) -> PictureTile<'a> {
141 PictureTile {
142 x: self.x,
143 y: self.y,
144 picture: self.picture,
145 }
146 }
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize, Default)]
152#[serde(rename_all = "camelCase")]
153pub struct Layer<'a> {
154 layerId: LayerId<'a>,
156 #[serde(skip_serializing_if = "Option::is_none")]
158 parentLayerId: Option<LayerId<'a>>,
159 #[serde(skip_serializing_if = "Option::is_none")]
161 backendNodeId: Option<crate::dom::BackendNodeId>,
162 offsetX: f64,
164 offsetY: f64,
166 width: f64,
168 height: f64,
170 #[serde(skip_serializing_if = "Option::is_none")]
172 transform: Option<Vec<f64>>,
173 #[serde(skip_serializing_if = "Option::is_none")]
175 anchorX: Option<f64>,
176 #[serde(skip_serializing_if = "Option::is_none")]
178 anchorY: Option<f64>,
179 #[serde(skip_serializing_if = "Option::is_none")]
181 anchorZ: Option<f64>,
182 paintCount: u64,
184 drawsContent: bool,
187 #[serde(skip_serializing_if = "Option::is_none")]
189 invisible: Option<bool>,
190 #[serde(skip_serializing_if = "Option::is_none")]
192 scrollRects: Option<Vec<ScrollRect<'a>>>,
193 #[serde(skip_serializing_if = "Option::is_none")]
195 stickyPositionConstraint: Option<StickyPositionConstraint<'a>>,
196}
197
198impl<'a> Layer<'a> {
199 pub fn builder(layerId: LayerId<'a>, offsetX: f64, offsetY: f64, width: f64, height: f64, paintCount: u64, drawsContent: bool) -> LayerBuilder<'a> {
200 LayerBuilder {
201 layerId: layerId,
202 parentLayerId: None,
203 backendNodeId: None,
204 offsetX: offsetX,
205 offsetY: offsetY,
206 width: width,
207 height: height,
208 transform: None,
209 anchorX: None,
210 anchorY: None,
211 anchorZ: None,
212 paintCount: paintCount,
213 drawsContent: drawsContent,
214 invisible: None,
215 scrollRects: None,
216 stickyPositionConstraint: None,
217 }
218 }
219 pub fn layerId(&self) -> &LayerId<'a> { &self.layerId }
220 pub fn parentLayerId(&self) -> Option<&LayerId<'a>> { self.parentLayerId.as_ref() }
221 pub fn backendNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.backendNodeId.as_ref() }
222 pub fn offsetX(&self) -> f64 { self.offsetX }
223 pub fn offsetY(&self) -> f64 { self.offsetY }
224 pub fn width(&self) -> f64 { self.width }
225 pub fn height(&self) -> f64 { self.height }
226 pub fn transform(&self) -> Option<&[f64]> { self.transform.as_deref() }
227 pub fn anchorX(&self) -> Option<f64> { self.anchorX }
228 pub fn anchorY(&self) -> Option<f64> { self.anchorY }
229 pub fn anchorZ(&self) -> Option<f64> { self.anchorZ }
230 pub fn paintCount(&self) -> u64 { self.paintCount }
231 pub fn drawsContent(&self) -> bool { self.drawsContent }
232 pub fn invisible(&self) -> Option<bool> { self.invisible }
233 pub fn scrollRects(&self) -> Option<&[ScrollRect<'a>]> { self.scrollRects.as_deref() }
234 pub fn stickyPositionConstraint(&self) -> Option<&StickyPositionConstraint<'a>> { self.stickyPositionConstraint.as_ref() }
235}
236
237
238pub struct LayerBuilder<'a> {
239 layerId: LayerId<'a>,
240 parentLayerId: Option<LayerId<'a>>,
241 backendNodeId: Option<crate::dom::BackendNodeId>,
242 offsetX: f64,
243 offsetY: f64,
244 width: f64,
245 height: f64,
246 transform: Option<Vec<f64>>,
247 anchorX: Option<f64>,
248 anchorY: Option<f64>,
249 anchorZ: Option<f64>,
250 paintCount: u64,
251 drawsContent: bool,
252 invisible: Option<bool>,
253 scrollRects: Option<Vec<ScrollRect<'a>>>,
254 stickyPositionConstraint: Option<StickyPositionConstraint<'a>>,
255}
256
257impl<'a> LayerBuilder<'a> {
258 pub fn parentLayerId(mut self, parentLayerId: LayerId<'a>) -> Self { self.parentLayerId = Some(parentLayerId); self }
260 pub fn backendNodeId(mut self, backendNodeId: crate::dom::BackendNodeId) -> Self { self.backendNodeId = Some(backendNodeId); self }
262 pub fn transform(mut self, transform: Vec<f64>) -> Self { self.transform = Some(transform); self }
264 pub fn anchorX(mut self, anchorX: f64) -> Self { self.anchorX = Some(anchorX); self }
266 pub fn anchorY(mut self, anchorY: f64) -> Self { self.anchorY = Some(anchorY); self }
268 pub fn anchorZ(mut self, anchorZ: f64) -> Self { self.anchorZ = Some(anchorZ); self }
270 pub fn invisible(mut self, invisible: bool) -> Self { self.invisible = Some(invisible); self }
272 pub fn scrollRects(mut self, scrollRects: Vec<ScrollRect<'a>>) -> Self { self.scrollRects = Some(scrollRects); self }
274 pub fn stickyPositionConstraint(mut self, stickyPositionConstraint: StickyPositionConstraint<'a>) -> Self { self.stickyPositionConstraint = Some(stickyPositionConstraint); self }
276 pub fn build(self) -> Layer<'a> {
277 Layer {
278 layerId: self.layerId,
279 parentLayerId: self.parentLayerId,
280 backendNodeId: self.backendNodeId,
281 offsetX: self.offsetX,
282 offsetY: self.offsetY,
283 width: self.width,
284 height: self.height,
285 transform: self.transform,
286 anchorX: self.anchorX,
287 anchorY: self.anchorY,
288 anchorZ: self.anchorZ,
289 paintCount: self.paintCount,
290 drawsContent: self.drawsContent,
291 invisible: self.invisible,
292 scrollRects: self.scrollRects,
293 stickyPositionConstraint: self.stickyPositionConstraint,
294 }
295 }
296}
297
298pub type PaintProfile = Vec<f64>;
301
302#[derive(Debug, Clone, Serialize, Deserialize, Default)]
305#[serde(rename_all = "camelCase")]
306pub struct CompositingReasonsParams<'a> {
307 layerId: LayerId<'a>,
309}
310
311impl<'a> CompositingReasonsParams<'a> {
312 pub fn builder(layerId: LayerId<'a>) -> CompositingReasonsParamsBuilder<'a> {
313 CompositingReasonsParamsBuilder {
314 layerId: layerId,
315 }
316 }
317 pub fn layerId(&self) -> &LayerId<'a> { &self.layerId }
318}
319
320
321pub struct CompositingReasonsParamsBuilder<'a> {
322 layerId: LayerId<'a>,
323}
324
325impl<'a> CompositingReasonsParamsBuilder<'a> {
326 pub fn build(self) -> CompositingReasonsParams<'a> {
327 CompositingReasonsParams {
328 layerId: self.layerId,
329 }
330 }
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize, Default)]
336#[serde(rename_all = "camelCase")]
337pub struct CompositingReasonsReturns<'a> {
338 compositingReasons: Vec<Cow<'a, str>>,
340 compositingReasonIds: Vec<Cow<'a, str>>,
342}
343
344impl<'a> CompositingReasonsReturns<'a> {
345 pub fn builder(compositingReasons: Vec<Cow<'a, str>>, compositingReasonIds: Vec<Cow<'a, str>>) -> CompositingReasonsReturnsBuilder<'a> {
346 CompositingReasonsReturnsBuilder {
347 compositingReasons: compositingReasons,
348 compositingReasonIds: compositingReasonIds,
349 }
350 }
351 pub fn compositingReasons(&self) -> &[Cow<'a, str>] { &self.compositingReasons }
352 pub fn compositingReasonIds(&self) -> &[Cow<'a, str>] { &self.compositingReasonIds }
353}
354
355
356pub struct CompositingReasonsReturnsBuilder<'a> {
357 compositingReasons: Vec<Cow<'a, str>>,
358 compositingReasonIds: Vec<Cow<'a, str>>,
359}
360
361impl<'a> CompositingReasonsReturnsBuilder<'a> {
362 pub fn build(self) -> CompositingReasonsReturns<'a> {
363 CompositingReasonsReturns {
364 compositingReasons: self.compositingReasons,
365 compositingReasonIds: self.compositingReasonIds,
366 }
367 }
368}
369
370impl<'a> CompositingReasonsParams<'a> { pub const METHOD: &'static str = "LayerTree.compositingReasons"; }
371
372impl<'a> crate::CdpCommand<'a> for CompositingReasonsParams<'a> {
373 const METHOD: &'static str = "LayerTree.compositingReasons";
374 type Response = CompositingReasonsReturns<'a>;
375}
376
377#[derive(Debug, Clone, Serialize, Deserialize, Default)]
378pub struct DisableParams {}
379
380impl DisableParams { pub const METHOD: &'static str = "LayerTree.disable"; }
381
382impl<'a> crate::CdpCommand<'a> for DisableParams {
383 const METHOD: &'static str = "LayerTree.disable";
384 type Response = crate::EmptyReturns;
385}
386
387#[derive(Debug, Clone, Serialize, Deserialize, Default)]
388pub struct EnableParams {}
389
390impl EnableParams { pub const METHOD: &'static str = "LayerTree.enable"; }
391
392impl<'a> crate::CdpCommand<'a> for EnableParams {
393 const METHOD: &'static str = "LayerTree.enable";
394 type Response = crate::EmptyReturns;
395}
396
397#[derive(Debug, Clone, Serialize, Deserialize, Default)]
400#[serde(rename_all = "camelCase")]
401pub struct LoadSnapshotParams<'a> {
402 tiles: Vec<PictureTile<'a>>,
404}
405
406impl<'a> LoadSnapshotParams<'a> {
407 pub fn builder(tiles: Vec<PictureTile<'a>>) -> LoadSnapshotParamsBuilder<'a> {
408 LoadSnapshotParamsBuilder {
409 tiles: tiles,
410 }
411 }
412 pub fn tiles(&self) -> &[PictureTile<'a>] { &self.tiles }
413}
414
415
416pub struct LoadSnapshotParamsBuilder<'a> {
417 tiles: Vec<PictureTile<'a>>,
418}
419
420impl<'a> LoadSnapshotParamsBuilder<'a> {
421 pub fn build(self) -> LoadSnapshotParams<'a> {
422 LoadSnapshotParams {
423 tiles: self.tiles,
424 }
425 }
426}
427
428#[derive(Debug, Clone, Serialize, Deserialize, Default)]
431#[serde(rename_all = "camelCase")]
432pub struct LoadSnapshotReturns<'a> {
433 snapshotId: SnapshotId<'a>,
435}
436
437impl<'a> LoadSnapshotReturns<'a> {
438 pub fn builder(snapshotId: SnapshotId<'a>) -> LoadSnapshotReturnsBuilder<'a> {
439 LoadSnapshotReturnsBuilder {
440 snapshotId: snapshotId,
441 }
442 }
443 pub fn snapshotId(&self) -> &SnapshotId<'a> { &self.snapshotId }
444}
445
446
447pub struct LoadSnapshotReturnsBuilder<'a> {
448 snapshotId: SnapshotId<'a>,
449}
450
451impl<'a> LoadSnapshotReturnsBuilder<'a> {
452 pub fn build(self) -> LoadSnapshotReturns<'a> {
453 LoadSnapshotReturns {
454 snapshotId: self.snapshotId,
455 }
456 }
457}
458
459impl<'a> LoadSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.loadSnapshot"; }
460
461impl<'a> crate::CdpCommand<'a> for LoadSnapshotParams<'a> {
462 const METHOD: &'static str = "LayerTree.loadSnapshot";
463 type Response = LoadSnapshotReturns<'a>;
464}
465
466#[derive(Debug, Clone, Serialize, Deserialize, Default)]
469#[serde(rename_all = "camelCase")]
470pub struct MakeSnapshotParams<'a> {
471 layerId: LayerId<'a>,
473}
474
475impl<'a> MakeSnapshotParams<'a> {
476 pub fn builder(layerId: LayerId<'a>) -> MakeSnapshotParamsBuilder<'a> {
477 MakeSnapshotParamsBuilder {
478 layerId: layerId,
479 }
480 }
481 pub fn layerId(&self) -> &LayerId<'a> { &self.layerId }
482}
483
484
485pub struct MakeSnapshotParamsBuilder<'a> {
486 layerId: LayerId<'a>,
487}
488
489impl<'a> MakeSnapshotParamsBuilder<'a> {
490 pub fn build(self) -> MakeSnapshotParams<'a> {
491 MakeSnapshotParams {
492 layerId: self.layerId,
493 }
494 }
495}
496
497#[derive(Debug, Clone, Serialize, Deserialize, Default)]
500#[serde(rename_all = "camelCase")]
501pub struct MakeSnapshotReturns<'a> {
502 snapshotId: SnapshotId<'a>,
504}
505
506impl<'a> MakeSnapshotReturns<'a> {
507 pub fn builder(snapshotId: SnapshotId<'a>) -> MakeSnapshotReturnsBuilder<'a> {
508 MakeSnapshotReturnsBuilder {
509 snapshotId: snapshotId,
510 }
511 }
512 pub fn snapshotId(&self) -> &SnapshotId<'a> { &self.snapshotId }
513}
514
515
516pub struct MakeSnapshotReturnsBuilder<'a> {
517 snapshotId: SnapshotId<'a>,
518}
519
520impl<'a> MakeSnapshotReturnsBuilder<'a> {
521 pub fn build(self) -> MakeSnapshotReturns<'a> {
522 MakeSnapshotReturns {
523 snapshotId: self.snapshotId,
524 }
525 }
526}
527
528impl<'a> MakeSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.makeSnapshot"; }
529
530impl<'a> crate::CdpCommand<'a> for MakeSnapshotParams<'a> {
531 const METHOD: &'static str = "LayerTree.makeSnapshot";
532 type Response = MakeSnapshotReturns<'a>;
533}
534
535
536#[derive(Debug, Clone, Serialize, Deserialize, Default)]
537#[serde(rename_all = "camelCase")]
538pub struct ProfileSnapshotParams<'a> {
539 snapshotId: SnapshotId<'a>,
541 #[serde(skip_serializing_if = "Option::is_none")]
543 minRepeatCount: Option<u64>,
544 #[serde(skip_serializing_if = "Option::is_none")]
546 minDuration: Option<f64>,
547 #[serde(skip_serializing_if = "Option::is_none")]
549 clipRect: Option<crate::dom::Rect>,
550}
551
552impl<'a> ProfileSnapshotParams<'a> {
553 pub fn builder(snapshotId: SnapshotId<'a>) -> ProfileSnapshotParamsBuilder<'a> {
554 ProfileSnapshotParamsBuilder {
555 snapshotId: snapshotId,
556 minRepeatCount: None,
557 minDuration: None,
558 clipRect: None,
559 }
560 }
561 pub fn snapshotId(&self) -> &SnapshotId<'a> { &self.snapshotId }
562 pub fn minRepeatCount(&self) -> Option<u64> { self.minRepeatCount }
563 pub fn minDuration(&self) -> Option<f64> { self.minDuration }
564 pub fn clipRect(&self) -> Option<&crate::dom::Rect> { self.clipRect.as_ref() }
565}
566
567
568pub struct ProfileSnapshotParamsBuilder<'a> {
569 snapshotId: SnapshotId<'a>,
570 minRepeatCount: Option<u64>,
571 minDuration: Option<f64>,
572 clipRect: Option<crate::dom::Rect>,
573}
574
575impl<'a> ProfileSnapshotParamsBuilder<'a> {
576 pub fn minRepeatCount(mut self, minRepeatCount: u64) -> Self { self.minRepeatCount = Some(minRepeatCount); self }
578 pub fn minDuration(mut self, minDuration: f64) -> Self { self.minDuration = Some(minDuration); self }
580 pub fn clipRect(mut self, clipRect: crate::dom::Rect) -> Self { self.clipRect = Some(clipRect); self }
582 pub fn build(self) -> ProfileSnapshotParams<'a> {
583 ProfileSnapshotParams {
584 snapshotId: self.snapshotId,
585 minRepeatCount: self.minRepeatCount,
586 minDuration: self.minDuration,
587 clipRect: self.clipRect,
588 }
589 }
590}
591
592
593#[derive(Debug, Clone, Serialize, Deserialize, Default)]
594#[serde(rename_all = "camelCase")]
595pub struct ProfileSnapshotReturns {
596 timings: Vec<PaintProfile>,
598}
599
600impl ProfileSnapshotReturns {
601 pub fn builder(timings: Vec<PaintProfile>) -> ProfileSnapshotReturnsBuilder {
602 ProfileSnapshotReturnsBuilder {
603 timings: timings,
604 }
605 }
606 pub fn timings(&self) -> &[PaintProfile] { &self.timings }
607}
608
609
610pub struct ProfileSnapshotReturnsBuilder {
611 timings: Vec<PaintProfile>,
612}
613
614impl ProfileSnapshotReturnsBuilder {
615 pub fn build(self) -> ProfileSnapshotReturns {
616 ProfileSnapshotReturns {
617 timings: self.timings,
618 }
619 }
620}
621
622impl<'a> ProfileSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.profileSnapshot"; }
623
624impl<'a> crate::CdpCommand<'a> for ProfileSnapshotParams<'a> {
625 const METHOD: &'static str = "LayerTree.profileSnapshot";
626 type Response = ProfileSnapshotReturns;
627}
628
629#[derive(Debug, Clone, Serialize, Deserialize, Default)]
632#[serde(rename_all = "camelCase")]
633pub struct ReleaseSnapshotParams<'a> {
634 snapshotId: SnapshotId<'a>,
636}
637
638impl<'a> ReleaseSnapshotParams<'a> {
639 pub fn builder(snapshotId: SnapshotId<'a>) -> ReleaseSnapshotParamsBuilder<'a> {
640 ReleaseSnapshotParamsBuilder {
641 snapshotId: snapshotId,
642 }
643 }
644 pub fn snapshotId(&self) -> &SnapshotId<'a> { &self.snapshotId }
645}
646
647
648pub struct ReleaseSnapshotParamsBuilder<'a> {
649 snapshotId: SnapshotId<'a>,
650}
651
652impl<'a> ReleaseSnapshotParamsBuilder<'a> {
653 pub fn build(self) -> ReleaseSnapshotParams<'a> {
654 ReleaseSnapshotParams {
655 snapshotId: self.snapshotId,
656 }
657 }
658}
659
660impl<'a> ReleaseSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.releaseSnapshot"; }
661
662impl<'a> crate::CdpCommand<'a> for ReleaseSnapshotParams<'a> {
663 const METHOD: &'static str = "LayerTree.releaseSnapshot";
664 type Response = crate::EmptyReturns;
665}
666
667#[derive(Debug, Clone, Serialize, Deserialize, Default)]
670#[serde(rename_all = "camelCase")]
671pub struct ReplaySnapshotParams<'a> {
672 snapshotId: SnapshotId<'a>,
674 #[serde(skip_serializing_if = "Option::is_none")]
676 fromStep: Option<i64>,
677 #[serde(skip_serializing_if = "Option::is_none")]
679 toStep: Option<i64>,
680 #[serde(skip_serializing_if = "Option::is_none")]
682 scale: Option<f64>,
683}
684
685impl<'a> ReplaySnapshotParams<'a> {
686 pub fn builder(snapshotId: SnapshotId<'a>) -> ReplaySnapshotParamsBuilder<'a> {
687 ReplaySnapshotParamsBuilder {
688 snapshotId: snapshotId,
689 fromStep: None,
690 toStep: None,
691 scale: None,
692 }
693 }
694 pub fn snapshotId(&self) -> &SnapshotId<'a> { &self.snapshotId }
695 pub fn fromStep(&self) -> Option<i64> { self.fromStep }
696 pub fn toStep(&self) -> Option<i64> { self.toStep }
697 pub fn scale(&self) -> Option<f64> { self.scale }
698}
699
700
701pub struct ReplaySnapshotParamsBuilder<'a> {
702 snapshotId: SnapshotId<'a>,
703 fromStep: Option<i64>,
704 toStep: Option<i64>,
705 scale: Option<f64>,
706}
707
708impl<'a> ReplaySnapshotParamsBuilder<'a> {
709 pub fn fromStep(mut self, fromStep: i64) -> Self { self.fromStep = Some(fromStep); self }
711 pub fn toStep(mut self, toStep: i64) -> Self { self.toStep = Some(toStep); self }
713 pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
715 pub fn build(self) -> ReplaySnapshotParams<'a> {
716 ReplaySnapshotParams {
717 snapshotId: self.snapshotId,
718 fromStep: self.fromStep,
719 toStep: self.toStep,
720 scale: self.scale,
721 }
722 }
723}
724
725#[derive(Debug, Clone, Serialize, Deserialize, Default)]
728#[serde(rename_all = "camelCase")]
729pub struct ReplaySnapshotReturns<'a> {
730 dataURL: Cow<'a, str>,
732}
733
734impl<'a> ReplaySnapshotReturns<'a> {
735 pub fn builder(dataURL: impl Into<Cow<'a, str>>) -> ReplaySnapshotReturnsBuilder<'a> {
736 ReplaySnapshotReturnsBuilder {
737 dataURL: dataURL.into(),
738 }
739 }
740 pub fn dataURL(&self) -> &str { self.dataURL.as_ref() }
741}
742
743
744pub struct ReplaySnapshotReturnsBuilder<'a> {
745 dataURL: Cow<'a, str>,
746}
747
748impl<'a> ReplaySnapshotReturnsBuilder<'a> {
749 pub fn build(self) -> ReplaySnapshotReturns<'a> {
750 ReplaySnapshotReturns {
751 dataURL: self.dataURL,
752 }
753 }
754}
755
756impl<'a> ReplaySnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.replaySnapshot"; }
757
758impl<'a> crate::CdpCommand<'a> for ReplaySnapshotParams<'a> {
759 const METHOD: &'static str = "LayerTree.replaySnapshot";
760 type Response = ReplaySnapshotReturns<'a>;
761}
762
763#[derive(Debug, Clone, Serialize, Deserialize, Default)]
766#[serde(rename_all = "camelCase")]
767pub struct SnapshotCommandLogParams<'a> {
768 snapshotId: SnapshotId<'a>,
770}
771
772impl<'a> SnapshotCommandLogParams<'a> {
773 pub fn builder(snapshotId: SnapshotId<'a>) -> SnapshotCommandLogParamsBuilder<'a> {
774 SnapshotCommandLogParamsBuilder {
775 snapshotId: snapshotId,
776 }
777 }
778 pub fn snapshotId(&self) -> &SnapshotId<'a> { &self.snapshotId }
779}
780
781
782pub struct SnapshotCommandLogParamsBuilder<'a> {
783 snapshotId: SnapshotId<'a>,
784}
785
786impl<'a> SnapshotCommandLogParamsBuilder<'a> {
787 pub fn build(self) -> SnapshotCommandLogParams<'a> {
788 SnapshotCommandLogParams {
789 snapshotId: self.snapshotId,
790 }
791 }
792}
793
794#[derive(Debug, Clone, Serialize, Deserialize, Default)]
797#[serde(rename_all = "camelCase")]
798pub struct SnapshotCommandLogReturns {
799 commandLog: Vec<serde_json::Map<String, JsonValue>>,
801}
802
803impl SnapshotCommandLogReturns {
804 pub fn builder(commandLog: Vec<serde_json::Map<String, JsonValue>>) -> SnapshotCommandLogReturnsBuilder {
805 SnapshotCommandLogReturnsBuilder {
806 commandLog: commandLog,
807 }
808 }
809 pub fn commandLog(&self) -> &[serde_json::Map<String, JsonValue>] { &self.commandLog }
810}
811
812
813pub struct SnapshotCommandLogReturnsBuilder {
814 commandLog: Vec<serde_json::Map<String, JsonValue>>,
815}
816
817impl SnapshotCommandLogReturnsBuilder {
818 pub fn build(self) -> SnapshotCommandLogReturns {
819 SnapshotCommandLogReturns {
820 commandLog: self.commandLog,
821 }
822 }
823}
824
825impl<'a> SnapshotCommandLogParams<'a> { pub const METHOD: &'static str = "LayerTree.snapshotCommandLog"; }
826
827impl<'a> crate::CdpCommand<'a> for SnapshotCommandLogParams<'a> {
828 const METHOD: &'static str = "LayerTree.snapshotCommandLog";
829 type Response = SnapshotCommandLogReturns;
830}