Skip to main content

rustenium_cdp_definitions/browser_protocol/performance/
command_builders.rs

1use super::commands::*;
2#[derive(Debug, Clone, Default)]
3pub struct DisableBuilder;
4impl DisableBuilder {
5    pub fn new() -> Self {
6        Self
7    }
8    pub fn build(self) -> Disable {
9        Disable {
10            method: DisableMethod::Disable,
11            params: DisableParams {},
12        }
13    }
14}
15impl Disable {
16    pub fn builder() -> DisableBuilder {
17        DisableBuilder
18    }
19}
20impl Enable {
21    pub fn builder() -> EnableBuilder {
22        <EnableBuilder as Default>::default()
23    }
24}
25#[derive(Default, Clone)]
26pub struct EnableBuilder {
27    time_domain: Option<EnableTimeDomain>,
28}
29impl EnableBuilder {
30    pub fn time_domain(mut self, time_domain: impl Into<EnableTimeDomain>) -> Self {
31        self.time_domain = Some(time_domain.into());
32        self
33    }
34    pub fn build(self) -> Enable {
35        Enable {
36            method: EnableMethod::Enable,
37            params: EnableParams {
38                time_domain: self.time_domain,
39            },
40        }
41    }
42}
43#[derive(Debug, Clone, Default)]
44pub struct GetMetricsBuilder;
45impl GetMetricsBuilder {
46    pub fn new() -> Self {
47        Self
48    }
49    pub fn build(self) -> GetMetrics {
50        GetMetrics {
51            method: GetMetricsMethod::GetMetrics,
52            params: GetMetricsParams {},
53        }
54    }
55}
56impl GetMetrics {
57    pub fn builder() -> GetMetricsBuilder {
58        GetMetricsBuilder
59    }
60}