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