use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;
pub type LayerId<'a> = Cow<'a, str>;
pub type SnapshotId<'a> = Cow<'a, str>;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ScrollRect<'a> {
rect: crate::dom::Rect,
#[serde(rename = "type")]
type_: Cow<'a, str>,
}
impl<'a> ScrollRect<'a> {
pub fn builder(rect: crate::dom::Rect, type_: impl Into<Cow<'a, str>>) -> ScrollRectBuilder<'a> {
ScrollRectBuilder {
rect: rect,
type_: type_.into(),
}
}
pub fn rect(&self) -> &crate::dom::Rect { &self.rect }
pub fn type_(&self) -> &str { self.type_.as_ref() }
}
pub struct ScrollRectBuilder<'a> {
rect: crate::dom::Rect,
type_: Cow<'a, str>,
}
impl<'a> ScrollRectBuilder<'a> {
pub fn build(self) -> ScrollRect<'a> {
ScrollRect {
rect: self.rect,
type_: self.type_,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StickyPositionConstraint<'a> {
#[serde(rename = "stickyBoxRect")]
sticky_box_rect: crate::dom::Rect,
#[serde(rename = "containingBlockRect")]
containing_block_rect: crate::dom::Rect,
#[serde(skip_serializing_if = "Option::is_none", rename = "nearestLayerShiftingStickyBox")]
nearest_layer_shifting_sticky_box: Option<LayerId<'a>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "nearestLayerShiftingContainingBlock")]
nearest_layer_shifting_containing_block: Option<LayerId<'a>>,
}
impl<'a> StickyPositionConstraint<'a> {
pub fn builder(sticky_box_rect: crate::dom::Rect, containing_block_rect: crate::dom::Rect) -> StickyPositionConstraintBuilder<'a> {
StickyPositionConstraintBuilder {
sticky_box_rect: sticky_box_rect,
containing_block_rect: containing_block_rect,
nearest_layer_shifting_sticky_box: None,
nearest_layer_shifting_containing_block: None,
}
}
pub fn sticky_box_rect(&self) -> &crate::dom::Rect { &self.sticky_box_rect }
pub fn containing_block_rect(&self) -> &crate::dom::Rect { &self.containing_block_rect }
pub fn nearest_layer_shifting_sticky_box(&self) -> Option<&LayerId<'a>> { self.nearest_layer_shifting_sticky_box.as_ref() }
pub fn nearest_layer_shifting_containing_block(&self) -> Option<&LayerId<'a>> { self.nearest_layer_shifting_containing_block.as_ref() }
}
pub struct StickyPositionConstraintBuilder<'a> {
sticky_box_rect: crate::dom::Rect,
containing_block_rect: crate::dom::Rect,
nearest_layer_shifting_sticky_box: Option<LayerId<'a>>,
nearest_layer_shifting_containing_block: Option<LayerId<'a>>,
}
impl<'a> StickyPositionConstraintBuilder<'a> {
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 }
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 }
pub fn build(self) -> StickyPositionConstraint<'a> {
StickyPositionConstraint {
sticky_box_rect: self.sticky_box_rect,
containing_block_rect: self.containing_block_rect,
nearest_layer_shifting_sticky_box: self.nearest_layer_shifting_sticky_box,
nearest_layer_shifting_containing_block: self.nearest_layer_shifting_containing_block,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PictureTile<'a> {
x: f64,
y: f64,
picture: Cow<'a, str>,
}
impl<'a> PictureTile<'a> {
pub fn builder(x: f64, y: f64, picture: impl Into<Cow<'a, str>>) -> PictureTileBuilder<'a> {
PictureTileBuilder {
x: x,
y: y,
picture: picture.into(),
}
}
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn picture(&self) -> &str { self.picture.as_ref() }
}
pub struct PictureTileBuilder<'a> {
x: f64,
y: f64,
picture: Cow<'a, str>,
}
impl<'a> PictureTileBuilder<'a> {
pub fn build(self) -> PictureTile<'a> {
PictureTile {
x: self.x,
y: self.y,
picture: self.picture,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Layer<'a> {
#[serde(rename = "layerId")]
layer_id: LayerId<'a>,
#[serde(skip_serializing_if = "Option::is_none", rename = "parentLayerId")]
parent_layer_id: Option<LayerId<'a>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
backend_node_id: Option<crate::dom::BackendNodeId>,
#[serde(rename = "offsetX")]
offset_x: f64,
#[serde(rename = "offsetY")]
offset_y: f64,
width: f64,
height: f64,
#[serde(skip_serializing_if = "Option::is_none")]
transform: Option<Vec<f64>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "anchorX")]
anchor_x: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none", rename = "anchorY")]
anchor_y: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none", rename = "anchorZ")]
anchor_z: Option<f64>,
#[serde(rename = "paintCount")]
paint_count: u64,
#[serde(rename = "drawsContent")]
draws_content: bool,
#[serde(skip_serializing_if = "Option::is_none")]
invisible: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none", rename = "scrollRects")]
scroll_rects: Option<Vec<ScrollRect<'a>>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "stickyPositionConstraint")]
sticky_position_constraint: Option<StickyPositionConstraint<'a>>,
}
impl<'a> Layer<'a> {
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> {
LayerBuilder {
layer_id: layer_id.into(),
parent_layer_id: None,
backend_node_id: None,
offset_x: offset_x,
offset_y: offset_y,
width: width,
height: height,
transform: None,
anchor_x: None,
anchor_y: None,
anchor_z: None,
paint_count: paint_count,
draws_content: draws_content,
invisible: None,
scroll_rects: None,
sticky_position_constraint: None,
}
}
pub fn layer_id(&self) -> &LayerId<'a> { &self.layer_id }
pub fn parent_layer_id(&self) -> Option<&LayerId<'a>> { self.parent_layer_id.as_ref() }
pub fn backend_node_id(&self) -> Option<&crate::dom::BackendNodeId> { self.backend_node_id.as_ref() }
pub fn offset_x(&self) -> f64 { self.offset_x }
pub fn offset_y(&self) -> f64 { self.offset_y }
pub fn width(&self) -> f64 { self.width }
pub fn height(&self) -> f64 { self.height }
pub fn transform(&self) -> Option<&[f64]> { self.transform.as_deref() }
pub fn anchor_x(&self) -> Option<f64> { self.anchor_x }
pub fn anchor_y(&self) -> Option<f64> { self.anchor_y }
pub fn anchor_z(&self) -> Option<f64> { self.anchor_z }
pub fn paint_count(&self) -> u64 { self.paint_count }
pub fn draws_content(&self) -> bool { self.draws_content }
pub fn invisible(&self) -> Option<bool> { self.invisible }
pub fn scroll_rects(&self) -> Option<&[ScrollRect<'a>]> { self.scroll_rects.as_deref() }
pub fn sticky_position_constraint(&self) -> Option<&StickyPositionConstraint<'a>> { self.sticky_position_constraint.as_ref() }
}
pub struct LayerBuilder<'a> {
layer_id: LayerId<'a>,
parent_layer_id: Option<LayerId<'a>>,
backend_node_id: Option<crate::dom::BackendNodeId>,
offset_x: f64,
offset_y: f64,
width: f64,
height: f64,
transform: Option<Vec<f64>>,
anchor_x: Option<f64>,
anchor_y: Option<f64>,
anchor_z: Option<f64>,
paint_count: u64,
draws_content: bool,
invisible: Option<bool>,
scroll_rects: Option<Vec<ScrollRect<'a>>>,
sticky_position_constraint: Option<StickyPositionConstraint<'a>>,
}
impl<'a> LayerBuilder<'a> {
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 }
pub fn backend_node_id(mut self, backend_node_id: crate::dom::BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
pub fn transform(mut self, transform: Vec<f64>) -> Self { self.transform = Some(transform); self }
pub fn anchor_x(mut self, anchor_x: f64) -> Self { self.anchor_x = Some(anchor_x); self }
pub fn anchor_y(mut self, anchor_y: f64) -> Self { self.anchor_y = Some(anchor_y); self }
pub fn anchor_z(mut self, anchor_z: f64) -> Self { self.anchor_z = Some(anchor_z); self }
pub fn invisible(mut self, invisible: bool) -> Self { self.invisible = Some(invisible); self }
pub fn scroll_rects(mut self, scroll_rects: Vec<ScrollRect<'a>>) -> Self { self.scroll_rects = Some(scroll_rects); self }
pub fn sticky_position_constraint(mut self, sticky_position_constraint: StickyPositionConstraint<'a>) -> Self { self.sticky_position_constraint = Some(sticky_position_constraint); self }
pub fn build(self) -> Layer<'a> {
Layer {
layer_id: self.layer_id,
parent_layer_id: self.parent_layer_id,
backend_node_id: self.backend_node_id,
offset_x: self.offset_x,
offset_y: self.offset_y,
width: self.width,
height: self.height,
transform: self.transform,
anchor_x: self.anchor_x,
anchor_y: self.anchor_y,
anchor_z: self.anchor_z,
paint_count: self.paint_count,
draws_content: self.draws_content,
invisible: self.invisible,
scroll_rects: self.scroll_rects,
sticky_position_constraint: self.sticky_position_constraint,
}
}
}
pub type PaintProfile = Vec<f64>;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CompositingReasonsParams<'a> {
#[serde(rename = "layerId")]
layer_id: LayerId<'a>,
}
impl<'a> CompositingReasonsParams<'a> {
pub fn builder(layer_id: impl Into<LayerId<'a>>) -> CompositingReasonsParamsBuilder<'a> {
CompositingReasonsParamsBuilder {
layer_id: layer_id.into(),
}
}
pub fn layer_id(&self) -> &LayerId<'a> { &self.layer_id }
}
pub struct CompositingReasonsParamsBuilder<'a> {
layer_id: LayerId<'a>,
}
impl<'a> CompositingReasonsParamsBuilder<'a> {
pub fn build(self) -> CompositingReasonsParams<'a> {
CompositingReasonsParams {
layer_id: self.layer_id,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CompositingReasonsReturns<'a> {
#[serde(rename = "compositingReasons")]
compositing_reasons: Vec<Cow<'a, str>>,
#[serde(rename = "compositingReasonIds")]
compositing_reason_ids: Vec<Cow<'a, str>>,
}
impl<'a> CompositingReasonsReturns<'a> {
pub fn builder(compositing_reasons: Vec<Cow<'a, str>>, compositing_reason_ids: Vec<Cow<'a, str>>) -> CompositingReasonsReturnsBuilder<'a> {
CompositingReasonsReturnsBuilder {
compositing_reasons: compositing_reasons,
compositing_reason_ids: compositing_reason_ids,
}
}
pub fn compositing_reasons(&self) -> &[Cow<'a, str>] { &self.compositing_reasons }
pub fn compositing_reason_ids(&self) -> &[Cow<'a, str>] { &self.compositing_reason_ids }
}
pub struct CompositingReasonsReturnsBuilder<'a> {
compositing_reasons: Vec<Cow<'a, str>>,
compositing_reason_ids: Vec<Cow<'a, str>>,
}
impl<'a> CompositingReasonsReturnsBuilder<'a> {
pub fn build(self) -> CompositingReasonsReturns<'a> {
CompositingReasonsReturns {
compositing_reasons: self.compositing_reasons,
compositing_reason_ids: self.compositing_reason_ids,
}
}
}
impl<'a> CompositingReasonsParams<'a> { pub const METHOD: &'static str = "LayerTree.compositingReasons"; }
impl<'a> crate::CdpCommand<'a> for CompositingReasonsParams<'a> {
const METHOD: &'static str = "LayerTree.compositingReasons";
type Response = CompositingReasonsReturns<'a>;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}
impl DisableParams { pub const METHOD: &'static str = "LayerTree.disable"; }
impl<'a> crate::CdpCommand<'a> for DisableParams {
const METHOD: &'static str = "LayerTree.disable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}
impl EnableParams { pub const METHOD: &'static str = "LayerTree.enable"; }
impl<'a> crate::CdpCommand<'a> for EnableParams {
const METHOD: &'static str = "LayerTree.enable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct LoadSnapshotParams<'a> {
tiles: Vec<PictureTile<'a>>,
}
impl<'a> LoadSnapshotParams<'a> {
pub fn builder(tiles: Vec<PictureTile<'a>>) -> LoadSnapshotParamsBuilder<'a> {
LoadSnapshotParamsBuilder {
tiles: tiles,
}
}
pub fn tiles(&self) -> &[PictureTile<'a>] { &self.tiles }
}
pub struct LoadSnapshotParamsBuilder<'a> {
tiles: Vec<PictureTile<'a>>,
}
impl<'a> LoadSnapshotParamsBuilder<'a> {
pub fn build(self) -> LoadSnapshotParams<'a> {
LoadSnapshotParams {
tiles: self.tiles,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct LoadSnapshotReturns<'a> {
#[serde(rename = "snapshotId")]
snapshot_id: SnapshotId<'a>,
}
impl<'a> LoadSnapshotReturns<'a> {
pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> LoadSnapshotReturnsBuilder<'a> {
LoadSnapshotReturnsBuilder {
snapshot_id: snapshot_id.into(),
}
}
pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
}
pub struct LoadSnapshotReturnsBuilder<'a> {
snapshot_id: SnapshotId<'a>,
}
impl<'a> LoadSnapshotReturnsBuilder<'a> {
pub fn build(self) -> LoadSnapshotReturns<'a> {
LoadSnapshotReturns {
snapshot_id: self.snapshot_id,
}
}
}
impl<'a> LoadSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.loadSnapshot"; }
impl<'a> crate::CdpCommand<'a> for LoadSnapshotParams<'a> {
const METHOD: &'static str = "LayerTree.loadSnapshot";
type Response = LoadSnapshotReturns<'a>;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct MakeSnapshotParams<'a> {
#[serde(rename = "layerId")]
layer_id: LayerId<'a>,
}
impl<'a> MakeSnapshotParams<'a> {
pub fn builder(layer_id: impl Into<LayerId<'a>>) -> MakeSnapshotParamsBuilder<'a> {
MakeSnapshotParamsBuilder {
layer_id: layer_id.into(),
}
}
pub fn layer_id(&self) -> &LayerId<'a> { &self.layer_id }
}
pub struct MakeSnapshotParamsBuilder<'a> {
layer_id: LayerId<'a>,
}
impl<'a> MakeSnapshotParamsBuilder<'a> {
pub fn build(self) -> MakeSnapshotParams<'a> {
MakeSnapshotParams {
layer_id: self.layer_id,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct MakeSnapshotReturns<'a> {
#[serde(rename = "snapshotId")]
snapshot_id: SnapshotId<'a>,
}
impl<'a> MakeSnapshotReturns<'a> {
pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> MakeSnapshotReturnsBuilder<'a> {
MakeSnapshotReturnsBuilder {
snapshot_id: snapshot_id.into(),
}
}
pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
}
pub struct MakeSnapshotReturnsBuilder<'a> {
snapshot_id: SnapshotId<'a>,
}
impl<'a> MakeSnapshotReturnsBuilder<'a> {
pub fn build(self) -> MakeSnapshotReturns<'a> {
MakeSnapshotReturns {
snapshot_id: self.snapshot_id,
}
}
}
impl<'a> MakeSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.makeSnapshot"; }
impl<'a> crate::CdpCommand<'a> for MakeSnapshotParams<'a> {
const METHOD: &'static str = "LayerTree.makeSnapshot";
type Response = MakeSnapshotReturns<'a>;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSnapshotParams<'a> {
#[serde(rename = "snapshotId")]
snapshot_id: SnapshotId<'a>,
#[serde(skip_serializing_if = "Option::is_none", rename = "minRepeatCount")]
min_repeat_count: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none", rename = "minDuration")]
min_duration: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none", rename = "clipRect")]
clip_rect: Option<crate::dom::Rect>,
}
impl<'a> ProfileSnapshotParams<'a> {
pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> ProfileSnapshotParamsBuilder<'a> {
ProfileSnapshotParamsBuilder {
snapshot_id: snapshot_id.into(),
min_repeat_count: None,
min_duration: None,
clip_rect: None,
}
}
pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
pub fn min_repeat_count(&self) -> Option<u64> { self.min_repeat_count }
pub fn min_duration(&self) -> Option<f64> { self.min_duration }
pub fn clip_rect(&self) -> Option<&crate::dom::Rect> { self.clip_rect.as_ref() }
}
pub struct ProfileSnapshotParamsBuilder<'a> {
snapshot_id: SnapshotId<'a>,
min_repeat_count: Option<u64>,
min_duration: Option<f64>,
clip_rect: Option<crate::dom::Rect>,
}
impl<'a> ProfileSnapshotParamsBuilder<'a> {
pub fn min_repeat_count(mut self, min_repeat_count: u64) -> Self { self.min_repeat_count = Some(min_repeat_count); self }
pub fn min_duration(mut self, min_duration: f64) -> Self { self.min_duration = Some(min_duration); self }
pub fn clip_rect(mut self, clip_rect: crate::dom::Rect) -> Self { self.clip_rect = Some(clip_rect); self }
pub fn build(self) -> ProfileSnapshotParams<'a> {
ProfileSnapshotParams {
snapshot_id: self.snapshot_id,
min_repeat_count: self.min_repeat_count,
min_duration: self.min_duration,
clip_rect: self.clip_rect,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSnapshotReturns {
timings: Vec<PaintProfile>,
}
impl ProfileSnapshotReturns {
pub fn builder(timings: Vec<PaintProfile>) -> ProfileSnapshotReturnsBuilder {
ProfileSnapshotReturnsBuilder {
timings: timings,
}
}
pub fn timings(&self) -> &[PaintProfile] { &self.timings }
}
pub struct ProfileSnapshotReturnsBuilder {
timings: Vec<PaintProfile>,
}
impl ProfileSnapshotReturnsBuilder {
pub fn build(self) -> ProfileSnapshotReturns {
ProfileSnapshotReturns {
timings: self.timings,
}
}
}
impl<'a> ProfileSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.profileSnapshot"; }
impl<'a> crate::CdpCommand<'a> for ProfileSnapshotParams<'a> {
const METHOD: &'static str = "LayerTree.profileSnapshot";
type Response = ProfileSnapshotReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseSnapshotParams<'a> {
#[serde(rename = "snapshotId")]
snapshot_id: SnapshotId<'a>,
}
impl<'a> ReleaseSnapshotParams<'a> {
pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> ReleaseSnapshotParamsBuilder<'a> {
ReleaseSnapshotParamsBuilder {
snapshot_id: snapshot_id.into(),
}
}
pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
}
pub struct ReleaseSnapshotParamsBuilder<'a> {
snapshot_id: SnapshotId<'a>,
}
impl<'a> ReleaseSnapshotParamsBuilder<'a> {
pub fn build(self) -> ReleaseSnapshotParams<'a> {
ReleaseSnapshotParams {
snapshot_id: self.snapshot_id,
}
}
}
impl<'a> ReleaseSnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.releaseSnapshot"; }
impl<'a> crate::CdpCommand<'a> for ReleaseSnapshotParams<'a> {
const METHOD: &'static str = "LayerTree.releaseSnapshot";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReplaySnapshotParams<'a> {
#[serde(rename = "snapshotId")]
snapshot_id: SnapshotId<'a>,
#[serde(skip_serializing_if = "Option::is_none", rename = "fromStep")]
from_step: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none", rename = "toStep")]
to_step: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
scale: Option<f64>,
}
impl<'a> ReplaySnapshotParams<'a> {
pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> ReplaySnapshotParamsBuilder<'a> {
ReplaySnapshotParamsBuilder {
snapshot_id: snapshot_id.into(),
from_step: None,
to_step: None,
scale: None,
}
}
pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
pub fn from_step(&self) -> Option<i64> { self.from_step }
pub fn to_step(&self) -> Option<i64> { self.to_step }
pub fn scale(&self) -> Option<f64> { self.scale }
}
pub struct ReplaySnapshotParamsBuilder<'a> {
snapshot_id: SnapshotId<'a>,
from_step: Option<i64>,
to_step: Option<i64>,
scale: Option<f64>,
}
impl<'a> ReplaySnapshotParamsBuilder<'a> {
pub fn from_step(mut self, from_step: i64) -> Self { self.from_step = Some(from_step); self }
pub fn to_step(mut self, to_step: i64) -> Self { self.to_step = Some(to_step); self }
pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
pub fn build(self) -> ReplaySnapshotParams<'a> {
ReplaySnapshotParams {
snapshot_id: self.snapshot_id,
from_step: self.from_step,
to_step: self.to_step,
scale: self.scale,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReplaySnapshotReturns<'a> {
#[serde(rename = "dataURL")]
data_url: Cow<'a, str>,
}
impl<'a> ReplaySnapshotReturns<'a> {
pub fn builder(data_url: impl Into<Cow<'a, str>>) -> ReplaySnapshotReturnsBuilder<'a> {
ReplaySnapshotReturnsBuilder {
data_url: data_url.into(),
}
}
pub fn data_url(&self) -> &str { self.data_url.as_ref() }
}
pub struct ReplaySnapshotReturnsBuilder<'a> {
data_url: Cow<'a, str>,
}
impl<'a> ReplaySnapshotReturnsBuilder<'a> {
pub fn build(self) -> ReplaySnapshotReturns<'a> {
ReplaySnapshotReturns {
data_url: self.data_url,
}
}
}
impl<'a> ReplaySnapshotParams<'a> { pub const METHOD: &'static str = "LayerTree.replaySnapshot"; }
impl<'a> crate::CdpCommand<'a> for ReplaySnapshotParams<'a> {
const METHOD: &'static str = "LayerTree.replaySnapshot";
type Response = ReplaySnapshotReturns<'a>;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SnapshotCommandLogParams<'a> {
#[serde(rename = "snapshotId")]
snapshot_id: SnapshotId<'a>,
}
impl<'a> SnapshotCommandLogParams<'a> {
pub fn builder(snapshot_id: impl Into<SnapshotId<'a>>) -> SnapshotCommandLogParamsBuilder<'a> {
SnapshotCommandLogParamsBuilder {
snapshot_id: snapshot_id.into(),
}
}
pub fn snapshot_id(&self) -> &SnapshotId<'a> { &self.snapshot_id }
}
pub struct SnapshotCommandLogParamsBuilder<'a> {
snapshot_id: SnapshotId<'a>,
}
impl<'a> SnapshotCommandLogParamsBuilder<'a> {
pub fn build(self) -> SnapshotCommandLogParams<'a> {
SnapshotCommandLogParams {
snapshot_id: self.snapshot_id,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SnapshotCommandLogReturns {
#[serde(rename = "commandLog")]
command_log: Vec<serde_json::Map<String, JsonValue>>,
}
impl SnapshotCommandLogReturns {
pub fn builder(command_log: Vec<serde_json::Map<String, JsonValue>>) -> SnapshotCommandLogReturnsBuilder {
SnapshotCommandLogReturnsBuilder {
command_log: command_log,
}
}
pub fn command_log(&self) -> &[serde_json::Map<String, JsonValue>] { &self.command_log }
}
pub struct SnapshotCommandLogReturnsBuilder {
command_log: Vec<serde_json::Map<String, JsonValue>>,
}
impl SnapshotCommandLogReturnsBuilder {
pub fn build(self) -> SnapshotCommandLogReturns {
SnapshotCommandLogReturns {
command_log: self.command_log,
}
}
}
impl<'a> SnapshotCommandLogParams<'a> { pub const METHOD: &'static str = "LayerTree.snapshotCommandLog"; }
impl<'a> crate::CdpCommand<'a> for SnapshotCommandLogParams<'a> {
const METHOD: &'static str = "LayerTree.snapshotCommandLog";
type Response = SnapshotCommandLogReturns;
}