Skip to main content

browser_protocol/deviceorientation/
mod.rs

1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6pub struct ClearDeviceOrientationOverrideParams {}
7
8impl ClearDeviceOrientationOverrideParams { pub const METHOD: &'static str = "DeviceOrientation.clearDeviceOrientationOverride"; }
9
10impl<'a> crate::CdpCommand<'a> for ClearDeviceOrientationOverrideParams {
11    const METHOD: &'static str = "DeviceOrientation.clearDeviceOrientationOverride";
12    type Response = crate::EmptyReturns;
13}
14
15/// Overrides the Device Orientation.
16
17#[derive(Debug, Clone, Serialize, Deserialize, Default)]
18#[serde(rename_all = "camelCase")]
19pub struct SetDeviceOrientationOverrideParams {
20    /// Mock alpha
21    alpha: f64,
22    /// Mock beta
23    beta: f64,
24    /// Mock gamma
25    gamma: f64,
26}
27
28impl SetDeviceOrientationOverrideParams {
29    pub fn builder(alpha: f64, beta: f64, gamma: f64) -> SetDeviceOrientationOverrideParamsBuilder {
30        SetDeviceOrientationOverrideParamsBuilder {
31            alpha: alpha,
32            beta: beta,
33            gamma: gamma,
34        }
35    }
36    pub fn alpha(&self) -> f64 { self.alpha }
37    pub fn beta(&self) -> f64 { self.beta }
38    pub fn gamma(&self) -> f64 { self.gamma }
39}
40
41
42pub struct SetDeviceOrientationOverrideParamsBuilder {
43    alpha: f64,
44    beta: f64,
45    gamma: f64,
46}
47
48impl SetDeviceOrientationOverrideParamsBuilder {
49    pub fn build(self) -> SetDeviceOrientationOverrideParams {
50        SetDeviceOrientationOverrideParams {
51            alpha: self.alpha,
52            beta: self.beta,
53            gamma: self.gamma,
54        }
55    }
56}
57
58impl SetDeviceOrientationOverrideParams { pub const METHOD: &'static str = "DeviceOrientation.setDeviceOrientationOverride"; }
59
60impl<'a> crate::CdpCommand<'a> for SetDeviceOrientationOverrideParams {
61    const METHOD: &'static str = "DeviceOrientation.setDeviceOrientationOverride";
62    type Response = crate::EmptyReturns;
63}