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    pub fn builder(port: i64) -> BindParamsBuilder {
19        BindParamsBuilder {
20            port: port,
21        }
22    }
23    pub fn port(&self) -> i64 { self.port }
24}
25
26
27pub struct BindParamsBuilder {
28    port: i64,
29}
30
31impl BindParamsBuilder {
32    pub fn build(self) -> BindParams {
33        BindParams {
34            port: self.port,
35        }
36    }
37}
38
39impl BindParams { pub const METHOD: &'static str = "Tethering.bind"; }
40
41impl<'a> crate::CdpCommand<'a> for BindParams {
42    const METHOD: &'static str = "Tethering.bind";
43    type Response = crate::EmptyReturns;
44}
45
46/// Request browser port unbinding.
47
48#[derive(Debug, Clone, Serialize, Deserialize, Default)]
49#[serde(rename_all = "camelCase")]
50pub struct UnbindParams {
51    /// Port number to unbind.
52    port: i64,
53}
54
55impl UnbindParams {
56    pub fn builder(port: i64) -> UnbindParamsBuilder {
57        UnbindParamsBuilder {
58            port: port,
59        }
60    }
61    pub fn port(&self) -> i64 { self.port }
62}
63
64
65pub struct UnbindParamsBuilder {
66    port: i64,
67}
68
69impl UnbindParamsBuilder {
70    pub fn build(self) -> UnbindParams {
71        UnbindParams {
72            port: self.port,
73        }
74    }
75}
76
77impl UnbindParams { pub const METHOD: &'static str = "Tethering.unbind"; }
78
79impl<'a> crate::CdpCommand<'a> for UnbindParams {
80    const METHOD: &'static str = "Tethering.unbind";
81    type Response = crate::EmptyReturns;
82}