Skip to main content

rustenium_cdp_definitions/browser_protocol/headless_experimental/
command_builders.rs

1use super::commands::*;
2impl BeginFrame {
3    pub fn builder() -> BeginFrameBuilder {
4        <BeginFrameBuilder as Default>::default()
5    }
6}
7#[derive(Default, Clone)]
8pub struct BeginFrameBuilder {
9    frame_time_ticks: Option<f64>,
10    interval: Option<f64>,
11    no_display_updates: Option<bool>,
12    screenshot: Option<super::types::ScreenshotParams>,
13}
14impl BeginFrameBuilder {
15    pub fn frame_time_ticks(mut self, frame_time_ticks: impl Into<f64>) -> Self {
16        self.frame_time_ticks = Some(frame_time_ticks.into());
17        self
18    }
19    pub fn interval(mut self, interval: impl Into<f64>) -> Self {
20        self.interval = Some(interval.into());
21        self
22    }
23    pub fn no_display_updates(mut self, no_display_updates: impl Into<bool>) -> Self {
24        self.no_display_updates = Some(no_display_updates.into());
25        self
26    }
27    pub fn screenshot(mut self, screenshot: impl Into<super::types::ScreenshotParams>) -> Self {
28        self.screenshot = Some(screenshot.into());
29        self
30    }
31    pub fn build(self) -> BeginFrame {
32        BeginFrame {
33            method: BeginFrameMethod::BeginFrame,
34            params: BeginFrameParams {
35                frame_time_ticks: self.frame_time_ticks,
36                interval: self.interval,
37                no_display_updates: self.no_display_updates,
38                screenshot: self.screenshot,
39            },
40        }
41    }
42}