rustenium_cdp_definitions/browser_protocol/target/
events.rs1use serde::{Deserialize, Serialize};
2#[doc = "Issued when attached to target because of auto-attach or `attachToTarget` command.\n[attachedToTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-attachedToTarget)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct AttachedToTargetParams {
5 #[doc = "Identifier assigned to the session used to send/receive messages."]
6 #[serde(rename = "sessionId")]
7 pub session_id: super::types::SessionId,
8 #[serde(rename = "targetInfo")]
9 pub target_info: super::types::TargetInfo,
10 #[serde(rename = "waitingForDebugger")]
11 pub waiting_for_debugger: bool,
12}
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14pub enum AttachedToTargetMethod {
15 #[serde(rename = "Target.attachedToTarget")]
16 AttachedToTarget,
17}
18#[doc = "Issued when attached to target because of auto-attach or `attachToTarget` command.\n[attachedToTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-attachedToTarget)"]
19#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
20pub struct AttachedToTarget {
21 pub method: AttachedToTargetMethod,
22 pub params: AttachedToTargetParams,
23}
24impl AttachedToTarget {
25 pub const IDENTIFIER: &'static str = "Target.attachedToTarget";
26 pub fn identifier(&self) -> &'static str {
27 Self::IDENTIFIER
28 }
29}
30#[doc = "Issued when detached from target for any reason (including `detachFromTarget` command). Can be\nissued multiple times per target if multiple sessions have been attached to it.\n[detachedFromTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-detachedFromTarget)"]
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub struct DetachedFromTargetParams {
33 #[doc = "Detached session identifier."]
34 #[serde(rename = "sessionId")]
35 pub session_id: super::types::SessionId,
36}
37#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
38pub enum DetachedFromTargetMethod {
39 #[serde(rename = "Target.detachedFromTarget")]
40 DetachedFromTarget,
41}
42#[doc = "Issued when detached from target for any reason (including `detachFromTarget` command). Can be\nissued multiple times per target if multiple sessions have been attached to it.\n[detachedFromTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-detachedFromTarget)"]
43#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
44pub struct DetachedFromTarget {
45 pub method: DetachedFromTargetMethod,
46 pub params: DetachedFromTargetParams,
47}
48impl DetachedFromTarget {
49 pub const IDENTIFIER: &'static str = "Target.detachedFromTarget";
50 pub fn identifier(&self) -> &'static str {
51 Self::IDENTIFIER
52 }
53}
54#[doc = "Notifies about a new protocol message received from the session (as reported in\n`attachedToTarget` event).\n[receivedMessageFromTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-receivedMessageFromTarget)"]
55#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
56pub struct ReceivedMessageFromTargetParams {
57 #[doc = "Identifier of a session which sends a message."]
58 #[serde(rename = "sessionId")]
59 pub session_id: super::types::SessionId,
60 #[serde(rename = "message")]
61 pub message: String,
62}
63#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
64pub enum ReceivedMessageFromTargetMethod {
65 #[serde(rename = "Target.receivedMessageFromTarget")]
66 ReceivedMessageFromTarget,
67}
68#[doc = "Notifies about a new protocol message received from the session (as reported in\n`attachedToTarget` event).\n[receivedMessageFromTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-receivedMessageFromTarget)"]
69#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
70pub struct ReceivedMessageFromTarget {
71 pub method: ReceivedMessageFromTargetMethod,
72 pub params: ReceivedMessageFromTargetParams,
73}
74impl ReceivedMessageFromTarget {
75 pub const IDENTIFIER: &'static str = "Target.receivedMessageFromTarget";
76 pub fn identifier(&self) -> &'static str {
77 Self::IDENTIFIER
78 }
79}
80#[doc = "Issued when a possible inspection target is created.\n[targetCreated](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetCreated)"]
81#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
82pub struct TargetCreatedParams {
83 #[serde(rename = "targetInfo")]
84 pub target_info: super::types::TargetInfo,
85}
86#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
87pub enum TargetCreatedMethod {
88 #[serde(rename = "Target.targetCreated")]
89 TargetCreated,
90}
91#[doc = "Issued when a possible inspection target is created.\n[targetCreated](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetCreated)"]
92#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
93pub struct TargetCreated {
94 pub method: TargetCreatedMethod,
95 pub params: TargetCreatedParams,
96}
97impl TargetCreated {
98 pub const IDENTIFIER: &'static str = "Target.targetCreated";
99 pub fn identifier(&self) -> &'static str {
100 Self::IDENTIFIER
101 }
102}
103#[doc = "Issued when a target is destroyed.\n[targetDestroyed](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetDestroyed)"]
104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
105pub struct TargetDestroyedParams {
106 #[serde(rename = "targetId")]
107 pub target_id: super::types::TargetId,
108}
109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
110pub enum TargetDestroyedMethod {
111 #[serde(rename = "Target.targetDestroyed")]
112 TargetDestroyed,
113}
114#[doc = "Issued when a target is destroyed.\n[targetDestroyed](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetDestroyed)"]
115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
116pub struct TargetDestroyed {
117 pub method: TargetDestroyedMethod,
118 pub params: TargetDestroyedParams,
119}
120impl TargetDestroyed {
121 pub const IDENTIFIER: &'static str = "Target.targetDestroyed";
122 pub fn identifier(&self) -> &'static str {
123 Self::IDENTIFIER
124 }
125}
126#[doc = "Issued when a target has crashed.\n[targetCrashed](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetCrashed)"]
127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
128pub struct TargetCrashedParams {
129 #[serde(rename = "targetId")]
130 pub target_id: super::types::TargetId,
131 #[doc = "Termination status type."]
132 #[serde(rename = "status")]
133 pub status: String,
134 #[doc = "Termination error code."]
135 #[serde(rename = "errorCode")]
136 pub error_code: i64,
137}
138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
139pub enum TargetCrashedMethod {
140 #[serde(rename = "Target.targetCrashed")]
141 TargetCrashed,
142}
143#[doc = "Issued when a target has crashed.\n[targetCrashed](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetCrashed)"]
144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
145pub struct TargetCrashed {
146 pub method: TargetCrashedMethod,
147 pub params: TargetCrashedParams,
148}
149impl TargetCrashed {
150 pub const IDENTIFIER: &'static str = "Target.targetCrashed";
151 pub fn identifier(&self) -> &'static str {
152 Self::IDENTIFIER
153 }
154}
155#[doc = "Issued when some information about a target has changed. This only happens between\n`targetCreated` and `targetDestroyed`.\n[targetInfoChanged](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetInfoChanged)"]
156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
157pub struct TargetInfoChangedParams {
158 #[serde(rename = "targetInfo")]
159 pub target_info: super::types::TargetInfo,
160}
161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
162pub enum TargetInfoChangedMethod {
163 #[serde(rename = "Target.targetInfoChanged")]
164 TargetInfoChanged,
165}
166#[doc = "Issued when some information about a target has changed. This only happens between\n`targetCreated` and `targetDestroyed`.\n[targetInfoChanged](https://chromedevtools.github.io/devtools-protocol/tot/Target/#event-targetInfoChanged)"]
167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
168pub struct TargetInfoChanged {
169 pub method: TargetInfoChangedMethod,
170 pub params: TargetInfoChangedParams,
171}
172impl TargetInfoChanged {
173 pub const IDENTIFIER: &'static str = "Target.targetInfoChanged";
174 pub fn identifier(&self) -> &'static str {
175 Self::IDENTIFIER
176 }
177}
178group_enum ! (TargetEvents { AttachedToTarget (AttachedToTarget) , DetachedFromTarget (DetachedFromTarget) , ReceivedMessageFromTarget (ReceivedMessageFromTarget) , TargetCreated (TargetCreated) , TargetDestroyed (TargetDestroyed) , TargetCrashed (TargetCrashed) , TargetInfoChanged (TargetInfoChanged) } + identifiable);