Skip to main content

browser_protocol/tethering/
mod.rs

1//! The Tethering domain defines methods and events for browser port binding.
2
3
4use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8/// Request browser port binding.
9
10#[derive(Debug, Clone, Serialize, Deserialize, Default)]
11#[serde(rename_all = "camelCase")]
12pub struct BindParams {
13    /// Port number to bind.
14    port: i64,
15}
16
17impl BindParams {
18    /// Creates a builder for this type with the required parameters:
19    /// * `port`: Port number to bind.
20    pub fn builder(port: i64) -> BindParamsBuilder {
21        BindParamsBuilder {
22            port: port,
23        }
24    }
25    /// Port number to bind.
26    pub fn port(&self) -> i64 { self.port }
27}
28
29
30pub struct BindParamsBuilder {
31    port: i64,
32}
33
34impl BindParamsBuilder {
35    pub fn build(self) -> BindParams {
36        BindParams {
37            port: self.port,
38        }
39    }
40}
41
42impl BindParams { pub const METHOD: &'static str = "Tethering.bind"; }
43
44impl<'a> crate::CdpCommand<'a> for BindParams {
45    const METHOD: &'static str = "Tethering.bind";
46    type Response = crate::EmptyReturns;
47}
48
49/// Request browser port unbinding.
50
51#[derive(Debug, Clone, Serialize, Deserialize, Default)]
52#[serde(rename_all = "camelCase")]
53pub struct UnbindParams {
54    /// Port number to unbind.
55    port: i64,
56}
57
58impl UnbindParams {
59    /// Creates a builder for this type with the required parameters:
60    /// * `port`: Port number to unbind.
61    pub fn builder(port: i64) -> UnbindParamsBuilder {
62        UnbindParamsBuilder {
63            port: port,
64        }
65    }
66    /// Port number to unbind.
67    pub fn port(&self) -> i64 { self.port }
68}
69
70
71pub struct UnbindParamsBuilder {
72    port: i64,
73}
74
75impl UnbindParamsBuilder {
76    pub fn build(self) -> UnbindParams {
77        UnbindParams {
78            port: self.port,
79        }
80    }
81}
82
83impl UnbindParams { pub const METHOD: &'static str = "Tethering.unbind"; }
84
85impl<'a> crate::CdpCommand<'a> for UnbindParams {
86    const METHOD: &'static str = "Tethering.unbind";
87    type Response = crate::EmptyReturns;
88}