#[derive(Debug, Clone, serde::Serialize)]
pub struct CaptureSnapshotParams {
#[serde(rename = "computedStyles")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub computed_styles: Vec<String>,
#[serde(rename = "includePaintOrder")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_paint_order: Option<bool>,
#[serde(rename = "includeDOMRects")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_dom_rects: Option<bool>,
#[serde(rename = "includeBlendedBackgroundColors")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_blended_background_colors: Option<bool>,
#[serde(rename = "includeTextColorOpacities")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_text_color_opacities: Option<bool>,
}
impl<'de> serde::Deserialize<'de> for CaptureSnapshotParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = CaptureSnapshotParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "computedStyles")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub computed_styles: Vec<String>,
#[serde(rename = "includePaintOrder")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_paint_order: Option<bool>,
#[serde(rename = "includeDOMRects")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_dom_rects: Option<bool>,
#[serde(rename = "includeBlendedBackgroundColors")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_blended_background_colors: Option<bool>,
#[serde(rename = "includeTextColorOpacities")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_text_color_opacities: Option<bool>,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(CaptureSnapshotParams {
computed_styles: fields.computed_styles,
include_paint_order: fields.include_paint_order,
include_dom_rects: fields.include_dom_rects,
include_blended_background_colors: fields.include_blended_background_colors,
include_text_color_opacities: fields.include_text_color_opacities,
})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct CaptureSnapshot;
#[derive(Debug, Clone, serde::Serialize)]
pub struct CaptureSnapshotResponse {
#[serde(rename = "documents")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub documents: Vec<crate::dom_snapshot::types::DocumentSnapshot>,
#[serde(rename = "strings")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub strings: Vec<String>,
}
impl<'de> serde::Deserialize<'de> for CaptureSnapshotResponse {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = CaptureSnapshotResponse;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "documents")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub documents: Vec<crate::dom_snapshot::types::DocumentSnapshot>,
#[serde(rename = "strings")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub strings: Vec<String>,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(CaptureSnapshotResponse {
documents: fields.documents,
strings: fields.strings,
})
}
}
d.deserialize_map(Visitor)
}
}
impl ydp_core::Command for CaptureSnapshot {
type Params = CaptureSnapshotParams;
type Response = CaptureSnapshotResponse;
const METHOD: &'static str = "DOMSnapshot.captureSnapshot";
}
#[derive(Debug, Clone, serde::Serialize, Default)]
pub struct DisableParams {}
impl<'de> serde::Deserialize<'de> for DisableParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = DisableParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {}
let _fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(DisableParams {})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct Disable;
#[derive(Debug, Clone, serde::Serialize)]
pub struct DisableResponse {}
impl<'de> serde::Deserialize<'de> for DisableResponse {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = DisableResponse;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {}
let _fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(DisableResponse {})
}
}
d.deserialize_map(Visitor)
}
}
impl ydp_core::Command for Disable {
type Params = DisableParams;
type Response = DisableResponse;
const METHOD: &'static str = "DOMSnapshot.disable";
}
#[derive(Debug, Clone, serde::Serialize, Default)]
pub struct EnableParams {}
impl<'de> serde::Deserialize<'de> for EnableParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = EnableParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {}
let _fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(EnableParams {})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct Enable;
#[derive(Debug, Clone, serde::Serialize)]
pub struct EnableResponse {}
impl<'de> serde::Deserialize<'de> for EnableResponse {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = EnableResponse;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {}
let _fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(EnableResponse {})
}
}
d.deserialize_map(Visitor)
}
}
impl ydp_core::Command for Enable {
type Params = EnableParams;
type Response = EnableResponse;
const METHOD: &'static str = "DOMSnapshot.enable";
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct GetSnapshotParams {
#[serde(rename = "computedStyleWhitelist")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub computed_style_whitelist: Vec<String>,
#[serde(rename = "includeEventListeners")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_event_listeners: Option<bool>,
#[serde(rename = "includePaintOrder")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_paint_order: Option<bool>,
#[serde(rename = "includeUserAgentShadowTree")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_user_agent_shadow_tree: Option<bool>,
}
impl<'de> serde::Deserialize<'de> for GetSnapshotParams {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = GetSnapshotParams;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "computedStyleWhitelist")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub computed_style_whitelist: Vec<String>,
#[serde(rename = "includeEventListeners")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_event_listeners: Option<bool>,
#[serde(rename = "includePaintOrder")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_paint_order: Option<bool>,
#[serde(rename = "includeUserAgentShadowTree")]
#[serde(
default,
deserialize_with = "ydp_core::binding_support::presence",
skip_serializing_if = "Option::is_none"
)]
pub include_user_agent_shadow_tree: Option<bool>,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(GetSnapshotParams {
computed_style_whitelist: fields.computed_style_whitelist,
include_event_listeners: fields.include_event_listeners,
include_paint_order: fields.include_paint_order,
include_user_agent_shadow_tree: fields.include_user_agent_shadow_tree,
})
}
}
d.deserialize_map(Visitor)
}
}
#[derive(Debug, Clone, Copy)]
pub struct GetSnapshot;
#[derive(Debug, Clone, serde::Serialize)]
pub struct GetSnapshotResponse {
#[serde(rename = "domNodes")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub dom_nodes: Vec<crate::dom_snapshot::types::DomNode>,
#[serde(rename = "layoutTreeNodes")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub layout_tree_nodes: Vec<crate::dom_snapshot::types::LayoutTreeNode>,
#[serde(rename = "computedStyles")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub computed_styles: Vec<crate::dom_snapshot::types::ComputedStyle>,
}
impl<'de> serde::Deserialize<'de> for GetSnapshotResponse {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = GetSnapshotResponse;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("协议 object")
}
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
a: A,
) -> Result<Self::Value, A::Error> {
#[derive(serde::Deserialize)]
struct Fields {
#[serde(rename = "domNodes")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub dom_nodes: Vec<crate::dom_snapshot::types::DomNode>,
#[serde(rename = "layoutTreeNodes")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub layout_tree_nodes: Vec<crate::dom_snapshot::types::LayoutTreeNode>,
#[serde(rename = "computedStyles")]
#[serde(deserialize_with = "ydp_core::binding_support::required")]
pub computed_styles: Vec<crate::dom_snapshot::types::ComputedStyle>,
}
let fields = <Fields as serde::Deserialize>::deserialize(
serde::de::value::MapAccessDeserializer::new(a),
)?;
Ok(GetSnapshotResponse {
dom_nodes: fields.dom_nodes,
layout_tree_nodes: fields.layout_tree_nodes,
computed_styles: fields.computed_styles,
})
}
}
d.deserialize_map(Visitor)
}
}
impl ydp_core::Command for GetSnapshot {
type Params = GetSnapshotParams;
type Response = GetSnapshotResponse;
const METHOD: &'static str = "DOMSnapshot.getSnapshot";
}