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> {
30 ScrollRectBuilder {
31 rect: rect,
32 type_: type_.into(),
33 }
34 }
35 pub fn rect(&self) -> &crate::dom::Rect { &self.rect }
37 pub fn type_(&self) -> &str { self.type_.as_ref() }
39}
40
41
42pub struct ScrollRectBuilder<'a> {
43 rect: crate::dom::Rect,
44 type_: Cow<'a, str>,
45}
46
47impl<'a> ScrollRectBuilder<'a> {
48 pub fn build(self) -> ScrollRect<'a> {
49 ScrollRect {
50 rect: self.rect,
51 type_: self.type_,
52 }
53 }
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, Default)]
59#[serde(rename_all = "camelCase")]
60pub struct StickyPositionConstraint<'a> {
61 #[serde(rename = "stickyBoxRect")]
63 sticky_box_rect: crate::dom::Rect,
64 #[serde(rename = "containingBlockRect")]
66 containing_block_rect: crate::dom::Rect,
67 #[serde(skip_serializing_if = "Option::is_none", rename = "nearestLayerShiftingStickyBox")]
69 nearest_layer_shifting_sticky_box: Option<LayerId<'a>>,
70 #[serde(skip_serializing_if = "Option::is_none", rename = "nearestLayerShiftingContainingBlock")]
72 nearest_layer_shifting_containing_block: Option<LayerId<'a>>,
73}
74
75impl<'a> StickyPositionConstraint<'a> {
76 pub fn builder(sticky_box_rect: crate::dom::Rect, containing_block_rect: crate::dom::Rect) -> StickyPositionConstraintBuilder<'a> {
80 StickyPositionConstraintBuilder {
81 sticky_box_rect: sticky_box_rect,
82 containing_block_rect: containing_block_rect,
83 nearest_layer_shifting_sticky_box: None,
84 nearest_layer_shifting_containing_block: None,
85 }
86 }
87 pub fn sticky_box_rect(&self) -> &crate::dom::Rect { &self.sticky_box_rect }
89 pub fn containing_block_rect(&self) -> &crate::dom::Rect { &self.containing_block_rect }
91 pub fn nearest_layer_shifting_sticky_box(&self) -> Option<&LayerId<'a>> { self.nearest_layer_shifting_sticky_box.as_ref() }
93 pub fn nearest_layer_shifting_containing_block(&self) -> Option<&LayerId<'a>> { self.nearest_layer_shifting_containing_block.as_ref() }
95}
96
97
98pub struct StickyPositionConstraintBuilder<'a> {
99 sticky_box_rect: crate::dom::Rect,
100 containing_block_rect: crate::dom::Rect,
101 nearest_layer_shifting_sticky_box: Option<LayerId<'a>>,
102 nearest_layer_shifting_containing_block: Option<LayerId<'a>>,
103}
104
105impl<'a> StickyPositionConstraintBuilder<'a> {
106 pub fn nearest_layer_shifting_sticky_box(mut self, nearest_layer_shifting_sticky_box: impl Into<LayerId<'a>>) -> Self { self.nearest_layer_shifting_sticky_box = Some(nearest_layer_shifting_sticky_box.into()); self }
108 pub fn nearest_layer_shifting_containing_block(mut self, nearest_layer_shifting_containing_block: impl Into<LayerId<'a>>) -> Self { self.nearest_layer_shifting_containing_block = Some(nearest_layer_shifting_containing_block.into()); self }
110 pub fn build(self) -> StickyPositionConstraint<'a> {
111 StickyPositionConstraint {
112 sticky_box_rect: self.sticky_box_rect,
113 containing_block_rect: self.containing_block_rect,
114 nearest_layer_shifting_sticky_box: self.nearest_layer_shifting_sticky_box,
115 nearest_layer_shifting_containing_block: self.nearest_layer_shifting_containing_block,
116 }
117 }
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize, Default)]
123#[serde(rename_all = "camelCase")]
124pub struct PictureTile<'a> {
125 x: f64,
127 y: f64,
129 picture: Cow<'a, str>,
131}
132
133impl<'a> PictureTile<'a> {
134 pub fn builder(x: f64, y: f64, picture: impl Into<Cow<'a, str>>) -> PictureTileBuilder<'a> {
139 PictureTileBuilder {
140 x: x,
141 y: y,
142 picture: picture.into(),
143 }
144 }
145 pub fn x(&self) -> f64 { self.x }
147 pub fn y(&self) -> f64 { self.y }
149 pub fn picture(&self) -> &str { self.picture.as_ref() }
151}
152
153
154pub struct PictureTileBuilder<'a> {
155 x: f64,
156 y: f64,
157 picture: Cow<'a, str>,
158}
159
160impl<'a> PictureTileBuilder<'a> {
161 pub fn build(self) -> PictureTile<'a> {
162 PictureTile {
163 x: self.x,
164 y: self.y,
165 picture: self.picture,
166 }
167 }
168}
169
170#[derive(Debug, Clone, Serialize, Deserialize, Default)]
173#[serde(rename_all = "camelCase")]
174pub struct Layer<'a> {
175 #[serde(rename = "layerId")]
177 layer_id: LayerId<'a>,
178 #[serde(skip_serializing_if = "Option::is_none", rename = "parentLayerId")]
180 parent_layer_id: Option<LayerId<'a>>,
181 #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
183 backend_node_id: Option<crate::dom::BackendNodeId>,
184 #[serde(rename = "offsetX")]
186 offset_x: f64,
187 #[serde(rename = "offsetY")]
189 offset_y: f64,
190 width: f64,
192 height: f64,
194 #[serde(skip_serializing_if = "Option::is_none")]
196 transform: Option<Vec<f64>>,
197 #[serde(skip_serializing_if = "Option::is_none", rename = "anchorX")]
199 anchor_x: Option<f64>,
200 #[serde(skip_serializing_if = "Option::is_none", rename = "anchorY")]
202 anchor_y: Option<f64>,
203 #[serde(skip_serializing_if = "Option::is_none", rename = "anchorZ")]
205 anchor_z: Option<f64>,
206 #[serde(rename = "paintCount")]
208 paint_count: u64,
209 #[serde(rename = "drawsContent")]
212 draws_content: bool,
213 #[serde(skip_serializing_if = "Option::is_none")]
215 invisible: Option<bool>,
216 #[serde(skip_serializing_if = "Option::is_none", rename = "scrollRects")]
218 scroll_rects: Option<Vec<ScrollRect<'a>>>,
219 #[serde(skip_serializing_if = "Option::is_none", rename = "stickyPositionConstraint")]
221 sticky_position_constraint: Option<StickyPositionConstraint<'a>>,
222}
223
224impl<'a> Layer<'a> {
225 pub fn builder(layer_id: impl Into<LayerId<'a>>, offset_x: f64, offset_y: f64, width: f64, height: f64, paint_count: u64, draws_content: bool) -> LayerBuilder<'a> {
234 LayerBuilder {
235 layer_id: layer_id.into(),
236 parent_layer_id: None,
237 backend_node_id: None,
238 offset_x: offset_x,
239 offset_y: offset_y,
240 width: width,
241 height: height,
242 transform: None,
243 anchor_x: None,
244 anchor_y: None,
245 anchor_z: None,
246 paint_count: paint_count,
247 draws_content: draws_content,
248 invisible: None,
249 scroll_rects: None,
250 sticky_position_constraint: None,
251 }
252 }
253 pub fn layer_id(&self) -> &LayerId<'a> { &self.layer_id }
255 pub fn parent_layer_id(&self) -> Option<&LayerId<'a>> { self.parent_layer_id.as_ref() }
257 pub fn backend_node_id(&self) -> Option<&crate::dom::BackendNodeId> { self.backend_node_id.as_ref() }
259 pub fn offset_x(&self) -> f64 { self.offset_x }
261 pub fn offset_y(&self) -> f64 { self.offset_y }
263 pub fn width(&self) -> f64 { self.width }
265 pub fn height(&self) -> f64 { self.height }
267 pub fn transform(&self) -> Option<&[f64]> { self.transform.as_deref() }
269 pub fn anchor_x(&self) -> Option<f64> { self.anchor_x }
271 pub fn anchor_y(&self) -> Option<f64> { self.anchor_y }
273 pub fn anchor_z(&self) -> Option<f64> { self.anchor_z }
275 pub fn paint_count(&self) -> u64 { self.paint_count }
277 pub fn draws_content(&self) -> bool { self.draws_content }
280 pub fn invisible(&self) -> Option<bool> { self.invisible }
282 pub fn scroll_rects(&self) -> Option<&[ScrollRect<'a>]> { self.scroll_rects.as_deref() }
284 pub fn sticky_position_constraint(&self) -> Option<&StickyPositionConstraint<'a>> { self.sticky_position_constraint.as_ref() }
286}
287
288
289pub struct LayerBuilder<'a> {
290 layer_id: LayerId<'a>,
291 parent_layer_id: Option<LayerId<'a>>,
292 backend_node_id: Option<crate::dom::BackendNodeId>,
293 offset_x: f64,
294 offset_y: f64,
295 width: f64,
296 height: f64,
297 transform: Option<Vec<f64>>,
298 anchor_x: Option<f64>,
299 anchor_y: Option<f64>,
300 anchor_z: Option<f64>,
301 paint_count: u64,
302 draws_content: bool,
303 invisible: Option<bool>,
304 scroll_rects: Option<Vec<ScrollRect<'a>>>,
305 sticky_position_constraint: Option<StickyPositionConstraint<'a>>,
306}
307
308impl<'a> LayerBuilder<'a> {
309 pub fn parent_layer_id(mut self, parent_layer_id: impl Into<LayerId<'a>>) -> Self { self.parent_layer_id = Some(parent_layer_id.into()); self }
311 pub fn backend_node_id(mut self, backend_node_id: crate::dom::BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
313 pub fn transform(mut self, transform: Vec<f64>) -> Self { self.transform = Some(transform); self }
315 pub fn anchor_x(mut self, anchor_x: f64) -> Self { self.anchor_x = Some(anchor_x); self }
317 pub fn anchor_y(mut self, anchor_y: f64) -> Self { self.anchor_y = Some(anchor_y); self }
319 pub fn anchor_z(mut self, anchor_z: f64) -> Self { self.anchor_z = Some(anchor_z); self }
321 pub fn invisible(mut self, invisible: bool) -> Self { self.invisible = Some(invisible); self }
323 pub fn scroll_rects(mut self, scroll_rects: Vec<ScrollRect<'a>>) -> Self { self.scroll_rects = Some(scroll_rects); self }
325 pub fn sticky_position_constraint(mut self, sticky_position_constraint: StickyPositionConstraint<'a>) -> Self { self.sticky_position_constraint = Some(sticky_position_constraint); self }
327 pub fn build(self) -> Layer<'a> {
328 Layer {
329 layer_id: self.layer_id,
330 parent_layer_id: self.parent_layer_id,
331 backend_node_id: self.backend_node_id,
332 offset_x: self.offset_x,
333 offset_y: self.offset_y,
334 width: self.width,
335 height: self.height,
336 transform: self.transform,
337 anchor_x: self.anchor_x,
338 anchor_y: self.anchor_y,
339 anchor_z: self.anchor_z,
340 paint_count: self.paint_count,
341 draws_content: self.draws_content,
342 invisible: self.invisible,
343 scroll_rects: self.scroll_rects,
344 sticky_position_constraint: self.sticky_position_constraint,
345 }
346 }
347}
348
349pub type PaintProfile = Vec<f64>;
352
353#[derive(Debug, Clone, Serialize, Deserialize, Default)]
356#[serde(rename_all = "camelCase")]
357pub struct CompositingReasonsParams<'a> {
358 #[serde(rename = "layerId")]
360 layer_id: LayerId<'a>,
361}
362
363impl<'a> CompositingReasonsParams<'a> {
364 pub fn builder(layer_id: impl Into<LayerId<'a>>) -> CompositingReasonsParamsBuilder<'a> {
367 CompositingReasonsParamsBuilder {
368 layer_id: layer_id.into(),
369 }
370 }
371 pub fn layer_id(&self) -> &LayerId<'a> { &self.layer_id }
373}
374
375
376pub struct CompositingReasonsParamsBuilder<'a> {
377 layer_id: LayerId<'a>,
378}
379
380impl<'a> CompositingReasonsParamsBuilder<'a> {
381 pub fn build(self) -> CompositingReasonsParams<'a> {
382 CompositingReasonsParams {
383 layer_id: self.layer_id,
384 }
385 }
386}
387
388#[derive(Debug, Clone, Serialize, Deserialize, Default)]
391#[serde(rename_all = "camelCase")]
392pub struct CompositingReasonsReturns<'a> {
393 #[serde(rename = "compositingReasons")]
395 compositing_reasons: Vec<Cow<'a, str>>,
396 #[serde(rename = "compositingReasonIds")]
398 compositing_reason_ids: Vec<Cow<'a, str>>,
399}
400
401impl<'a> CompositingReasonsReturns<'a> {
402 pub fn builder(compositing_reasons: Vec<Cow<'a, str>>, compositing_reason_ids: Vec<Cow<'a, str>>) -> CompositingReasonsReturnsBuilder<'a> {
406 CompositingReasonsReturnsBuilder {
407 compositing_reasons: compositing_reasons,
408 compositing_reason_ids: compositing_reason_ids,
409 }
410 }
411 pub fn compositing_reasons(&self) -> &[Cow<'a, str>] { &self.compositing_reasons }
413 pub fn compositing_reason_ids(&self) -> &[Cow<'a, str>] { &self.compositing_reason_ids }
415}
416
417
418pub struct CompositingReasonsReturnsBuilder<'a> {
419 compositing_reasons: Vec<Cow<'a, str>>,
420 compositing_reason_ids: Vec<Cow<'a, str>>,
421}
422
423impl<'a> CompositingReasonsReturnsBuilder<'a> {
424 pub fn build(self) -> CompositingReasonsReturns<'a> {
425 CompositingReasonsReturns {
426 compositing_reasons: self.compositing_reasons,
427 compositing_reason_ids: self.compositing_reason_ids,
428 }
429 }
430}
431
432impl<'a> CompositingReasonsParams<'a> { pub const METHOD: &'static str = "LayerTree.compositingReasons"; }
433
434impl<'a> crate::CdpCommand<'a> for CompositingReasonsParams<'a> {
435 const METHOD: &'static str = "LayerTree.compositingReasons";
436 type Response = CompositingReasonsReturns<'a>;
437}
438
439#[derive(Debug, Clone, Serialize, Deserialize, Default)]
440pub struct DisableParams {}
441
442impl DisableParams { pub const METHOD: &'static str = "LayerTree.disable"; }
443
444impl<'a> crate::CdpCommand<'a> for DisableParams {
445 const METHOD: &'static str = "LayerTree.disable";
446 type Response = crate::EmptyReturns;
447}
448
449#[derive(Debug, Clone, Serialize, Deserialize, Default)]
450pub struct EnableParams {}
451
452impl EnableParams { pub const METHOD: &'static str = "LayerTree.enable"; }
453
454impl<'a> crate::CdpCommand<'a> for EnableParams {
455 const METHOD: &'static str = "LayerTree.enable";
456 type Response = crate::EmptyReturns;
457}
458
459#[derive(Debug, Clone, Serialize, Deserialize, Default)]
462#[serde(rename_all = "camelCase")]
463pub struct LoadSnapshotParams<'a> {
464 tiles: Vec<PictureTile<'a>>,
466}
467
468impl<'a> LoadSnapshotParams<'a> {
469 pub fn builder(tiles: Vec<PictureTile<'a>>) -> LoadSnapshotParamsBuilder<'a> {
472 LoadSnapshotParamsBuilder {
473 tiles: tiles,
474 }
475 }
476 pub fn tiles(&self) -> &[PictureTile<'a>] { &self.tiles }
478}
479
480
481pub struct LoadSnapshotParamsBuilder<'a> {
482 tiles: Vec<PictureTile<'a>>,
483}
484
485impl<'a> LoadSnapshotParamsBuilder<'a> {
486 pub fn build(self) -> LoadSnapshotParams<'a> {
487 LoadSnapshotParams {
488 tiles: self.tiles,
489 }
490 }
491}
492
493#[derive(Debug, Clone, Serialize, Deserialize, Default)]
496#[serde(rename_all = "camelCase")]
497pub struct LoadSnapshotReturns<'a> {
498 #[serde(rename = "snapshotId")]
500 snapshot_id: SnapshotId<'a>,
501}
502
503impl<'a> LoadSnapshotReturns<'a> {
504 pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> LoadSnapshotReturnsBuilder<'a> {
507 LoadSnapshotReturnsBuilder {
508 snapshot_id: snapshot_id.into(),
509 }
510 }
511 pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
513}
514
515
516pub struct LoadSnapshotReturnsBuilder<'a> {
517 snapshot_id: SnapshotId<'a>,
518}
519
520impl<'a> LoadSnapshotReturnsBuilder<'a> {
521 pub fn build(self) -> LoadSnapshotReturns<'a> {
522 LoadSnapshotReturns {
523 snapshot_id: self.snapshot_id,
524 }
525 }
526}
527
528impl<'a> LoadSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.loadSnapshot"; }
529
530impl<'a> crate::CdpCommand<'a> for LoadSnapshotParams<'a> {
531 const METHOD: &'static str = "LayerTree.loadSnapshot";
532 type Response = LoadSnapshotReturns<'a>;
533}
534
535#[derive(Debug, Clone, Serialize, Deserialize, Default)]
538#[serde(rename_all = "camelCase")]
539pub struct MakeSnapshotParams<'a> {
540 #[serde(rename = "layerId")]
542 layer_id: LayerId<'a>,
543}
544
545impl<'a> MakeSnapshotParams<'a> {
546 pub fn builder(layer_id: impl Into<LayerId<'a>>) -> MakeSnapshotParamsBuilder<'a> {
549 MakeSnapshotParamsBuilder {
550 layer_id: layer_id.into(),
551 }
552 }
553 pub fn layer_id(&self) -> &LayerId<'a> { &self.layer_id }
555}
556
557
558pub struct MakeSnapshotParamsBuilder<'a> {
559 layer_id: LayerId<'a>,
560}
561
562impl<'a> MakeSnapshotParamsBuilder<'a> {
563 pub fn build(self) -> MakeSnapshotParams<'a> {
564 MakeSnapshotParams {
565 layer_id: self.layer_id,
566 }
567 }
568}
569
570#[derive(Debug, Clone, Serialize, Deserialize, Default)]
573#[serde(rename_all = "camelCase")]
574pub struct MakeSnapshotReturns<'a> {
575 #[serde(rename = "snapshotId")]
577 snapshot_id: SnapshotId<'a>,
578}
579
580impl<'a> MakeSnapshotReturns<'a> {
581 pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> MakeSnapshotReturnsBuilder<'a> {
584 MakeSnapshotReturnsBuilder {
585 snapshot_id: snapshot_id.into(),
586 }
587 }
588 pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
590}
591
592
593pub struct MakeSnapshotReturnsBuilder<'a> {
594 snapshot_id: SnapshotId<'a>,
595}
596
597impl<'a> MakeSnapshotReturnsBuilder<'a> {
598 pub fn build(self) -> MakeSnapshotReturns<'a> {
599 MakeSnapshotReturns {
600 snapshot_id: self.snapshot_id,
601 }
602 }
603}
604
605impl<'a> MakeSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.makeSnapshot"; }
606
607impl<'a> crate::CdpCommand<'a> for MakeSnapshotParams<'a> {
608 const METHOD: &'static str = "LayerTree.makeSnapshot";
609 type Response = MakeSnapshotReturns<'a>;
610}
611
612
613#[derive(Debug, Clone, Serialize, Deserialize, Default)]
614#[serde(rename_all = "camelCase")]
615pub struct ProfileSnapshotParams<'a> {
616 #[serde(rename = "snapshotId")]
618 snapshot_id: SnapshotId<'a>,
619 #[serde(skip_serializing_if = "Option::is_none", rename = "minRepeatCount")]
621 min_repeat_count: Option<u64>,
622 #[serde(skip_serializing_if = "Option::is_none", rename = "minDuration")]
624 min_duration: Option<f64>,
625 #[serde(skip_serializing_if = "Option::is_none", rename = "clipRect")]
627 clip_rect: Option<crate::dom::Rect>,
628}
629
630impl<'a> ProfileSnapshotParams<'a> {
631 pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> ProfileSnapshotParamsBuilder<'a> {
634 ProfileSnapshotParamsBuilder {
635 snapshot_id: snapshot_id.into(),
636 min_repeat_count: None,
637 min_duration: None,
638 clip_rect: None,
639 }
640 }
641 pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
643 pub fn min_repeat_count(&self) -> Option<u64> { self.min_repeat_count }
645 pub fn min_duration(&self) -> Option<f64> { self.min_duration }
647 pub fn clip_rect(&self) -> Option<&crate::dom::Rect> { self.clip_rect.as_ref() }
649}
650
651
652pub struct ProfileSnapshotParamsBuilder<'a> {
653 snapshot_id: SnapshotId<'a>,
654 min_repeat_count: Option<u64>,
655 min_duration: Option<f64>,
656 clip_rect: Option<crate::dom::Rect>,
657}
658
659impl<'a> ProfileSnapshotParamsBuilder<'a> {
660 pub fn min_repeat_count(mut self, min_repeat_count: u64) -> Self { self.min_repeat_count = Some(min_repeat_count); self }
662 pub fn min_duration(mut self, min_duration: f64) -> Self { self.min_duration = Some(min_duration); self }
664 pub fn clip_rect(mut self, clip_rect: crate::dom::Rect) -> Self { self.clip_rect = Some(clip_rect); self }
666 pub fn build(self) -> ProfileSnapshotParams<'a> {
667 ProfileSnapshotParams {
668 snapshot_id: self.snapshot_id,
669 min_repeat_count: self.min_repeat_count,
670 min_duration: self.min_duration,
671 clip_rect: self.clip_rect,
672 }
673 }
674}
675
676
677#[derive(Debug, Clone, Serialize, Deserialize, Default)]
678#[serde(rename_all = "camelCase")]
679pub struct ProfileSnapshotReturns {
680 timings: Vec<PaintProfile>,
682}
683
684impl ProfileSnapshotReturns {
685 pub fn builder(timings: Vec<PaintProfile>) -> ProfileSnapshotReturnsBuilder {
688 ProfileSnapshotReturnsBuilder {
689 timings: timings,
690 }
691 }
692 pub fn timings(&self) -> &[PaintProfile] { &self.timings }
694}
695
696
697pub struct ProfileSnapshotReturnsBuilder {
698 timings: Vec<PaintProfile>,
699}
700
701impl ProfileSnapshotReturnsBuilder {
702 pub fn build(self) -> ProfileSnapshotReturns {
703 ProfileSnapshotReturns {
704 timings: self.timings,
705 }
706 }
707}
708
709impl<'a> ProfileSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.profileSnapshot"; }
710
711impl<'a> crate::CdpCommand<'a> for ProfileSnapshotParams<'a> {
712 const METHOD: &'static str = "LayerTree.profileSnapshot";
713 type Response = ProfileSnapshotReturns;
714}
715
716#[derive(Debug, Clone, Serialize, Deserialize, Default)]
719#[serde(rename_all = "camelCase")]
720pub struct ReleaseSnapshotParams<'a> {
721 #[serde(rename = "snapshotId")]
723 snapshot_id: SnapshotId<'a>,
724}
725
726impl<'a> ReleaseSnapshotParams<'a> {
727 pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> ReleaseSnapshotParamsBuilder<'a> {
730 ReleaseSnapshotParamsBuilder {
731 snapshot_id: snapshot_id.into(),
732 }
733 }
734 pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
736}
737
738
739pub struct ReleaseSnapshotParamsBuilder<'a> {
740 snapshot_id: SnapshotId<'a>,
741}
742
743impl<'a> ReleaseSnapshotParamsBuilder<'a> {
744 pub fn build(self) -> ReleaseSnapshotParams<'a> {
745 ReleaseSnapshotParams {
746 snapshot_id: self.snapshot_id,
747 }
748 }
749}
750
751impl<'a> ReleaseSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.releaseSnapshot"; }
752
753impl<'a> crate::CdpCommand<'a> for ReleaseSnapshotParams<'a> {
754 const METHOD: &'static str = "LayerTree.releaseSnapshot";
755 type Response = crate::EmptyReturns;
756}
757
758#[derive(Debug, Clone, Serialize, Deserialize, Default)]
761#[serde(rename_all = "camelCase")]
762pub struct ReplaySnapshotParams<'a> {
763 #[serde(rename = "snapshotId")]
765 snapshot_id: SnapshotId<'a>,
766 #[serde(skip_serializing_if = "Option::is_none", rename = "fromStep")]
768 from_step: Option<i64>,
769 #[serde(skip_serializing_if = "Option::is_none", rename = "toStep")]
771 to_step: Option<i64>,
772 #[serde(skip_serializing_if = "Option::is_none")]
774 scale: Option<f64>,
775}
776
777impl<'a> ReplaySnapshotParams<'a> {
778 pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> ReplaySnapshotParamsBuilder<'a> {
781 ReplaySnapshotParamsBuilder {
782 snapshot_id: snapshot_id.into(),
783 from_step: None,
784 to_step: None,
785 scale: None,
786 }
787 }
788 pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
790 pub fn from_step(&self) -> Option<i64> { self.from_step }
792 pub fn to_step(&self) -> Option<i64> { self.to_step }
794 pub fn scale(&self) -> Option<f64> { self.scale }
796}
797
798
799pub struct ReplaySnapshotParamsBuilder<'a> {
800 snapshot_id: SnapshotId<'a>,
801 from_step: Option<i64>,
802 to_step: Option<i64>,
803 scale: Option<f64>,
804}
805
806impl<'a> ReplaySnapshotParamsBuilder<'a> {
807 pub fn from_step(mut self, from_step: i64) -> Self { self.from_step = Some(from_step); self }
809 pub fn to_step(mut self, to_step: i64) -> Self { self.to_step = Some(to_step); self }
811 pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
813 pub fn build(self) -> ReplaySnapshotParams<'a> {
814 ReplaySnapshotParams {
815 snapshot_id: self.snapshot_id,
816 from_step: self.from_step,
817 to_step: self.to_step,
818 scale: self.scale,
819 }
820 }
821}
822
823#[derive(Debug, Clone, Serialize, Deserialize, Default)]
826#[serde(rename_all = "camelCase")]
827pub struct ReplaySnapshotReturns<'a> {
828 #[serde(rename = "dataURL")]
830 data_url: Cow<'a, str>,
831}
832
833impl<'a> ReplaySnapshotReturns<'a> {
834 pub fn builder(data_url: impl Into<Cow<'a, str>>) -> ReplaySnapshotReturnsBuilder<'a> {
837 ReplaySnapshotReturnsBuilder {
838 data_url: data_url.into(),
839 }
840 }
841 pub fn data_url(&self) -> &str { self.data_url.as_ref() }
843}
844
845
846pub struct ReplaySnapshotReturnsBuilder<'a> {
847 data_url: Cow<'a, str>,
848}
849
850impl<'a> ReplaySnapshotReturnsBuilder<'a> {
851 pub fn build(self) -> ReplaySnapshotReturns<'a> {
852 ReplaySnapshotReturns {
853 data_url: self.data_url,
854 }
855 }
856}
857
858impl<'a> ReplaySnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.replaySnapshot"; }
859
860impl<'a> crate::CdpCommand<'a> for ReplaySnapshotParams<'a> {
861 const METHOD: &'static str = "LayerTree.replaySnapshot";
862 type Response = ReplaySnapshotReturns<'a>;
863}
864
865#[derive(Debug, Clone, Serialize, Deserialize, Default)]
868#[serde(rename_all = "camelCase")]
869pub struct SnapshotCommandLogParams<'a> {
870 #[serde(rename = "snapshotId")]
872 snapshot_id: SnapshotId<'a>,
873}
874
875impl<'a> SnapshotCommandLogParams<'a> {
876 pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> SnapshotCommandLogParamsBuilder<'a> {
879 SnapshotCommandLogParamsBuilder {
880 snapshot_id: snapshot_id.into(),
881 }
882 }
883 pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
885}
886
887
888pub struct SnapshotCommandLogParamsBuilder<'a> {
889 snapshot_id: SnapshotId<'a>,
890}
891
892impl<'a> SnapshotCommandLogParamsBuilder<'a> {
893 pub fn build(self) -> SnapshotCommandLogParams<'a> {
894 SnapshotCommandLogParams {
895 snapshot_id: self.snapshot_id,
896 }
897 }
898}
899
900#[derive(Debug, Clone, Serialize, Deserialize, Default)]
903#[serde(rename_all = "camelCase")]
904pub struct SnapshotCommandLogReturns {
905 #[serde(rename = "commandLog")]
907 command_log: Vec<serde_json::Map<String, JsonValue>>,
908}
909
910impl SnapshotCommandLogReturns {
911 pub fn builder(command_log: Vec<serde_json::Map<String, JsonValue>>) -> SnapshotCommandLogReturnsBuilder {
914 SnapshotCommandLogReturnsBuilder {
915 command_log: command_log,
916 }
917 }
918 pub fn command_log(&self) -> &[serde_json::Map<String, JsonValue>] { &self.command_log }
920}
921
922
923pub struct SnapshotCommandLogReturnsBuilder {
924 command_log: Vec<serde_json::Map<String, JsonValue>>,
925}
926
927impl SnapshotCommandLogReturnsBuilder {
928 pub fn build(self) -> SnapshotCommandLogReturns {
929 SnapshotCommandLogReturns {
930 command_log: self.command_log,
931 }
932 }
933}
934
935impl<'a> SnapshotCommandLogParams<'a> { pub const METHOD: &'static str = "LayerTree.snapshotCommandLog"; }
936
937impl<'a> crate::CdpCommand<'a> for SnapshotCommandLogParams<'a> {
938 const METHOD: &'static str = "LayerTree.snapshotCommandLog";
939 type Response = SnapshotCommandLogReturns;
940}