1use serde::{Serialize, Deserialize};
6use serde_json::Value as JsonValue;
7use std::borrow::Cow;
8
9
10#[derive(Debug, Clone, Serialize, Deserialize, Default)]
11#[serde(rename_all = "camelCase")]
12pub struct Sink<'a> {
13 name: Cow<'a, str>,
14 id: Cow<'a, str>,
15 #[serde(skip_serializing_if = "Option::is_none")]
18 session: Option<Cow<'a, str>>,
19}
20
21impl<'a> Sink<'a> {
22 pub fn builder(name: impl Into<Cow<'a, str>>, id: impl Into<Cow<'a, str>>) -> SinkBuilder<'a> {
26 SinkBuilder {
27 name: name.into(),
28 id: id.into(),
29 session: None,
30 }
31 }
32 pub fn name(&self) -> &str { self.name.as_ref() }
33 pub fn id(&self) -> &str { self.id.as_ref() }
34 pub fn session(&self) -> Option<&str> { self.session.as_deref() }
37}
38
39
40pub struct SinkBuilder<'a> {
41 name: Cow<'a, str>,
42 id: Cow<'a, str>,
43 session: Option<Cow<'a, str>>,
44}
45
46impl<'a> SinkBuilder<'a> {
47 pub fn session(mut self, session: impl Into<Cow<'a, str>>) -> Self { self.session = Some(session.into()); self }
50 pub fn build(self) -> Sink<'a> {
51 Sink {
52 name: self.name,
53 id: self.id,
54 session: self.session,
55 }
56 }
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize, Default)]
66#[serde(rename_all = "camelCase")]
67pub struct EnableParams<'a> {
68 #[serde(skip_serializing_if = "Option::is_none", rename = "presentationUrl")]
69 presentation_url: Option<Cow<'a, str>>,
70}
71
72impl<'a> EnableParams<'a> {
73 pub fn builder() -> EnableParamsBuilder<'a> {
75 EnableParamsBuilder {
76 presentation_url: None,
77 }
78 }
79 pub fn presentation_url(&self) -> Option<&str> { self.presentation_url.as_deref() }
80}
81
82#[derive(Default)]
83pub struct EnableParamsBuilder<'a> {
84 presentation_url: Option<Cow<'a, str>>,
85}
86
87impl<'a> EnableParamsBuilder<'a> {
88 pub fn presentation_url(mut self, presentation_url: impl Into<Cow<'a, str>>) -> Self { self.presentation_url = Some(presentation_url.into()); self }
89 pub fn build(self) -> EnableParams<'a> {
90 EnableParams {
91 presentation_url: self.presentation_url,
92 }
93 }
94}
95
96impl<'a> EnableParams<'a> { pub const METHOD: &'static str = "Cast.enable"; }
97
98impl<'a> crate::CdpCommand<'a> for EnableParams<'a> {
99 const METHOD: &'static str = "Cast.enable";
100 type Response = crate::EmptyReturns;
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize, Default)]
104pub struct DisableParams {}
105
106impl DisableParams { pub const METHOD: &'static str = "Cast.disable"; }
107
108impl<'a> crate::CdpCommand<'a> for DisableParams {
109 const METHOD: &'static str = "Cast.disable";
110 type Response = crate::EmptyReturns;
111}
112
113#[derive(Debug, Clone, Serialize, Deserialize, Default)]
117#[serde(rename_all = "camelCase")]
118pub struct SetSinkToUseParams<'a> {
119 #[serde(rename = "sinkName")]
120 sink_name: Cow<'a, str>,
121}
122
123impl<'a> SetSinkToUseParams<'a> {
124 pub fn builder(sink_name: impl Into<Cow<'a, str>>) -> SetSinkToUseParamsBuilder<'a> {
127 SetSinkToUseParamsBuilder {
128 sink_name: sink_name.into(),
129 }
130 }
131 pub fn sink_name(&self) -> &str { self.sink_name.as_ref() }
132}
133
134
135pub struct SetSinkToUseParamsBuilder<'a> {
136 sink_name: Cow<'a, str>,
137}
138
139impl<'a> SetSinkToUseParamsBuilder<'a> {
140 pub fn build(self) -> SetSinkToUseParams<'a> {
141 SetSinkToUseParams {
142 sink_name: self.sink_name,
143 }
144 }
145}
146
147impl<'a> SetSinkToUseParams<'a> { pub const METHOD: &'static str = "Cast.setSinkToUse"; }
148
149impl<'a> crate::CdpCommand<'a> for SetSinkToUseParams<'a> {
150 const METHOD: &'static str = "Cast.setSinkToUse";
151 type Response = crate::EmptyReturns;
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize, Default)]
157#[serde(rename_all = "camelCase")]
158pub struct StartDesktopMirroringParams<'a> {
159 #[serde(rename = "sinkName")]
160 sink_name: Cow<'a, str>,
161}
162
163impl<'a> StartDesktopMirroringParams<'a> {
164 pub fn builder(sink_name: impl Into<Cow<'a, str>>) -> StartDesktopMirroringParamsBuilder<'a> {
167 StartDesktopMirroringParamsBuilder {
168 sink_name: sink_name.into(),
169 }
170 }
171 pub fn sink_name(&self) -> &str { self.sink_name.as_ref() }
172}
173
174
175pub struct StartDesktopMirroringParamsBuilder<'a> {
176 sink_name: Cow<'a, str>,
177}
178
179impl<'a> StartDesktopMirroringParamsBuilder<'a> {
180 pub fn build(self) -> StartDesktopMirroringParams<'a> {
181 StartDesktopMirroringParams {
182 sink_name: self.sink_name,
183 }
184 }
185}
186
187impl<'a> StartDesktopMirroringParams<'a> { pub const METHOD: &'static str = "Cast.startDesktopMirroring"; }
188
189impl<'a> crate::CdpCommand<'a> for StartDesktopMirroringParams<'a> {
190 const METHOD: &'static str = "Cast.startDesktopMirroring";
191 type Response = crate::EmptyReturns;
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize, Default)]
197#[serde(rename_all = "camelCase")]
198pub struct StartTabMirroringParams<'a> {
199 #[serde(rename = "sinkName")]
200 sink_name: Cow<'a, str>,
201}
202
203impl<'a> StartTabMirroringParams<'a> {
204 pub fn builder(sink_name: impl Into<Cow<'a, str>>) -> StartTabMirroringParamsBuilder<'a> {
207 StartTabMirroringParamsBuilder {
208 sink_name: sink_name.into(),
209 }
210 }
211 pub fn sink_name(&self) -> &str { self.sink_name.as_ref() }
212}
213
214
215pub struct StartTabMirroringParamsBuilder<'a> {
216 sink_name: Cow<'a, str>,
217}
218
219impl<'a> StartTabMirroringParamsBuilder<'a> {
220 pub fn build(self) -> StartTabMirroringParams<'a> {
221 StartTabMirroringParams {
222 sink_name: self.sink_name,
223 }
224 }
225}
226
227impl<'a> StartTabMirroringParams<'a> { pub const METHOD: &'static str = "Cast.startTabMirroring"; }
228
229impl<'a> crate::CdpCommand<'a> for StartTabMirroringParams<'a> {
230 const METHOD: &'static str = "Cast.startTabMirroring";
231 type Response = crate::EmptyReturns;
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize, Default)]
237#[serde(rename_all = "camelCase")]
238pub struct StopCastingParams<'a> {
239 #[serde(rename = "sinkName")]
240 sink_name: Cow<'a, str>,
241}
242
243impl<'a> StopCastingParams<'a> {
244 pub fn builder(sink_name: impl Into<Cow<'a, str>>) -> StopCastingParamsBuilder<'a> {
247 StopCastingParamsBuilder {
248 sink_name: sink_name.into(),
249 }
250 }
251 pub fn sink_name(&self) -> &str { self.sink_name.as_ref() }
252}
253
254
255pub struct StopCastingParamsBuilder<'a> {
256 sink_name: Cow<'a, str>,
257}
258
259impl<'a> StopCastingParamsBuilder<'a> {
260 pub fn build(self) -> StopCastingParams<'a> {
261 StopCastingParams {
262 sink_name: self.sink_name,
263 }
264 }
265}
266
267impl<'a> StopCastingParams<'a> { pub const METHOD: &'static str = "Cast.stopCasting"; }
268
269impl<'a> crate::CdpCommand<'a> for StopCastingParams<'a> {
270 const METHOD: &'static str = "Cast.stopCasting";
271 type Response = crate::EmptyReturns;
272}