Skip to main content

cdp_protocol/
performance_timeline.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: PerformanceTimeline
2#![allow(dead_code)]
3use super::dom;
4use super::network;
5use super::page;
6#[allow(unused_imports)]
7use super::types::*;
8#[allow(unused_imports)]
9use derive_builder::Builder;
10#[allow(unused_imports)]
11use serde::{Deserialize, Serialize};
12#[allow(unused_imports)]
13use serde_json::Value as Json;
14#[allow(deprecated)]
15#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
16#[builder(setter(into, strip_option))]
17#[serde(rename_all = "camelCase")]
18#[doc = "See <https://github.com/WICG/LargestContentfulPaint> and largest_contentful_paint.idl"]
19pub struct LargestContentfulPaint {
20    pub render_time: network::TimeSinceEpoch,
21    pub load_time: network::TimeSinceEpoch,
22    #[serde(default)]
23    #[doc = "The number of pixels being painted."]
24    pub size: JsFloat,
25    #[builder(default)]
26    #[serde(skip_serializing_if = "Option::is_none")]
27    #[serde(default)]
28    #[doc = "The id attribute of the element, if available."]
29    pub element_id: Option<String>,
30    #[builder(default)]
31    #[serde(skip_serializing_if = "Option::is_none")]
32    #[serde(default)]
33    #[doc = "The URL of the image (may be trimmed)."]
34    pub url: Option<String>,
35    #[builder(default)]
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub node_id: Option<dom::BackendNodeId>,
38}
39#[allow(deprecated)]
40#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
41#[builder(setter(into, strip_option))]
42#[serde(rename_all = "camelCase")]
43pub struct LayoutShiftAttribution {
44    pub previous_rect: dom::Rect,
45    pub current_rect: dom::Rect,
46    #[builder(default)]
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub node_id: Option<dom::BackendNodeId>,
49}
50#[allow(deprecated)]
51#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
52#[builder(setter(into, strip_option))]
53#[serde(rename_all = "camelCase")]
54#[doc = "See <https://wicg.github.io/layout-instability/#sec-layout-shift> and layout_shift.idl"]
55pub struct LayoutShift {
56    #[serde(default)]
57    #[doc = "Score increment produced by this event."]
58    pub value: JsFloat,
59    #[serde(default)]
60    pub had_recent_input: bool,
61    pub last_input_time: network::TimeSinceEpoch,
62    pub sources: Vec<LayoutShiftAttribution>,
63}
64#[allow(deprecated)]
65#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
66#[builder(setter(into, strip_option))]
67#[serde(rename_all = "camelCase")]
68pub struct TimelineEvent {
69    #[doc = "Identifies the frame that this event is related to. Empty for non-frame targets."]
70    pub frame_id: page::FrameId,
71    #[serde(default)]
72    #[doc = "The event type, as specified in <https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype>\n This determines which of the optional \"details\" fields is present."]
73    pub r#type: String,
74    #[serde(default)]
75    #[doc = "Name may be empty depending on the type."]
76    pub name: String,
77    #[doc = "Time in seconds since Epoch, monotonically increasing within document lifetime."]
78    pub time: network::TimeSinceEpoch,
79    #[builder(default)]
80    #[serde(skip_serializing_if = "Option::is_none")]
81    #[serde(default)]
82    #[doc = "Event duration, if applicable."]
83    pub duration: Option<JsFloat>,
84    #[builder(default)]
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub lcp_details: Option<LargestContentfulPaint>,
87    #[builder(default)]
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub layout_shift_details: Option<LayoutShift>,
90}
91#[allow(deprecated)]
92#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
93#[builder(setter(into, strip_option))]
94#[serde(rename_all = "camelCase")]
95#[doc = "Previously buffered events would be reported before method returns.\n See also: timelineEventAdded"]
96pub struct Enable {
97    #[serde(default)]
98    #[doc = "The types of event to report, as specified in\n <https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype>\n The specified filter overrides any previous filters, passing empty\n filter disables recording.\n Note that not all types exposed to the web platform are currently supported."]
99    pub event_types: Vec<String>,
100}
101#[allow(deprecated)]
102#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
103#[doc = "Previously buffered events would be reported before method returns.\n See also: timelineEventAdded"]
104pub struct EnableReturnObject(pub Option<Json>);
105#[allow(deprecated)]
106impl Method for Enable {
107    const NAME: &'static str = "PerformanceTimeline.enable";
108    type ReturnObject = EnableReturnObject;
109}
110#[allow(dead_code)]
111pub mod events {
112    #[allow(unused_imports)]
113    use super::super::types::*;
114    #[allow(unused_imports)]
115    use derive_builder::Builder;
116    #[allow(unused_imports)]
117    use serde::{Deserialize, Serialize};
118    #[allow(unused_imports)]
119    use serde_json::Value as Json;
120    #[allow(deprecated)]
121    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
122    pub struct TimelineEventAddedEvent {
123        pub params: TimelineEventAddedEventParams,
124    }
125    #[allow(deprecated)]
126    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
127    #[serde(rename_all = "camelCase")]
128    pub struct TimelineEventAddedEventParams {
129        pub event: super::TimelineEvent,
130    }
131}