chrome_devtools/domain/runtime/method/
mod.rs1use serde::{Deserialize, Serialize};
4
5pub mod r#type;
6
7mod get_isolate_id;
8
9use r#type::Id;
10
11use std::fmt;
12
13#[derive(Debug, Serialize, Deserialize)]
14#[serde(tag = "method")]
15#[non_exhaustive]
16pub enum SendMethod {
17 #[serde(rename = "Runtime.enable")]
18 Enable(SendId),
19 #[serde(rename = "Runtime.disable")]
20 Disable(SendId),
21 #[serde(rename = "Runtime.getIsolateId")]
22 GetIsolateId(SendId),
23}
24
25impl fmt::Display for SendMethod {
26 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
27 write!(f, "{:?}", &self)
28 }
29}
30
31#[derive(Debug, Serialize, Deserialize)]
32#[serde(tag = "method")]
33#[non_exhaustive]
34pub enum ReturnMethod {
35 #[serde(rename = "Runtime.enable")]
36 Enable(Id),
37 #[serde(rename = "Runtime.disable")]
38 Disable(Id),
39 #[serde(rename = "Runtime.getIsolateId")]
40 GetIsolateId(get_isolate_id::Return),
41}
42
43#[derive(Debug, Serialize, Deserialize)]
44pub struct SendId {
45 id: Id,
46}
47
48impl From<u64> for SendId {
49 fn from(id: u64) -> Self {
50 SendId { id }
51 }
52}