1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5
6#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7#[serde(rename_all = "camelCase")]
8pub struct TouchPoint {
9 x: f64,
11 y: f64,
14 #[serde(skip_serializing_if = "Option::is_none")]
16 radiusX: Option<f64>,
17 #[serde(skip_serializing_if = "Option::is_none")]
19 radiusY: Option<f64>,
20 #[serde(skip_serializing_if = "Option::is_none")]
22 rotationAngle: Option<f64>,
23 #[serde(skip_serializing_if = "Option::is_none")]
25 force: Option<f64>,
26 #[serde(skip_serializing_if = "Option::is_none")]
28 tangentialPressure: Option<f64>,
29 #[serde(skip_serializing_if = "Option::is_none")]
31 tiltX: Option<f64>,
32 #[serde(skip_serializing_if = "Option::is_none")]
34 tiltY: Option<f64>,
35 #[serde(skip_serializing_if = "Option::is_none")]
37 twist: Option<i64>,
38 #[serde(skip_serializing_if = "Option::is_none")]
40 id: Option<f64>,
41}
42
43impl TouchPoint {
44 pub fn builder(x: f64, y: f64) -> TouchPointBuilder {
45 TouchPointBuilder {
46 x: x,
47 y: y,
48 radiusX: None,
49 radiusY: None,
50 rotationAngle: None,
51 force: None,
52 tangentialPressure: None,
53 tiltX: None,
54 tiltY: None,
55 twist: None,
56 id: None,
57 }
58 }
59 pub fn x(&self) -> f64 { self.x }
60 pub fn y(&self) -> f64 { self.y }
61 pub fn radiusX(&self) -> Option<f64> { self.radiusX }
62 pub fn radiusY(&self) -> Option<f64> { self.radiusY }
63 pub fn rotationAngle(&self) -> Option<f64> { self.rotationAngle }
64 pub fn force(&self) -> Option<f64> { self.force }
65 pub fn tangentialPressure(&self) -> Option<f64> { self.tangentialPressure }
66 pub fn tiltX(&self) -> Option<f64> { self.tiltX }
67 pub fn tiltY(&self) -> Option<f64> { self.tiltY }
68 pub fn twist(&self) -> Option<i64> { self.twist }
69 pub fn id(&self) -> Option<f64> { self.id }
70}
71
72
73pub struct TouchPointBuilder {
74 x: f64,
75 y: f64,
76 radiusX: Option<f64>,
77 radiusY: Option<f64>,
78 rotationAngle: Option<f64>,
79 force: Option<f64>,
80 tangentialPressure: Option<f64>,
81 tiltX: Option<f64>,
82 tiltY: Option<f64>,
83 twist: Option<i64>,
84 id: Option<f64>,
85}
86
87impl TouchPointBuilder {
88 pub fn radiusX(mut self, radiusX: f64) -> Self { self.radiusX = Some(radiusX); self }
90 pub fn radiusY(mut self, radiusY: f64) -> Self { self.radiusY = Some(radiusY); self }
92 pub fn rotationAngle(mut self, rotationAngle: f64) -> Self { self.rotationAngle = Some(rotationAngle); self }
94 pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
96 pub fn tangentialPressure(mut self, tangentialPressure: f64) -> Self { self.tangentialPressure = Some(tangentialPressure); self }
98 pub fn tiltX(mut self, tiltX: f64) -> Self { self.tiltX = Some(tiltX); self }
100 pub fn tiltY(mut self, tiltY: f64) -> Self { self.tiltY = Some(tiltY); self }
102 pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
104 pub fn id(mut self, id: f64) -> Self { self.id = Some(id); self }
106 pub fn build(self) -> TouchPoint {
107 TouchPoint {
108 x: self.x,
109 y: self.y,
110 radiusX: self.radiusX,
111 radiusY: self.radiusY,
112 rotationAngle: self.rotationAngle,
113 force: self.force,
114 tangentialPressure: self.tangentialPressure,
115 tiltX: self.tiltX,
116 tiltY: self.tiltY,
117 twist: self.twist,
118 id: self.id,
119 }
120 }
121}
122
123
124#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
125pub enum GestureSourceType {
126 #[default]
127 #[serde(rename = "default")]
128 Default,
129 #[serde(rename = "touch")]
130 Touch,
131 #[serde(rename = "mouse")]
132 Mouse,
133}
134
135
136#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
137pub enum MouseButton {
138 #[default]
139 #[serde(rename = "none")]
140 None,
141 #[serde(rename = "left")]
142 Left,
143 #[serde(rename = "middle")]
144 Middle,
145 #[serde(rename = "right")]
146 Right,
147 #[serde(rename = "back")]
148 Back,
149 #[serde(rename = "forward")]
150 Forward,
151}
152
153pub type TimeSinceEpoch = f64;
156
157
158#[derive(Debug, Clone, Serialize, Deserialize, Default)]
159#[serde(rename_all = "camelCase")]
160pub struct DragDataItem<'a> {
161 mimeType: Cow<'a, str>,
163 data: Cow<'a, str>,
166 #[serde(skip_serializing_if = "Option::is_none")]
168 title: Option<Cow<'a, str>>,
169 #[serde(skip_serializing_if = "Option::is_none")]
172 baseURL: Option<Cow<'a, str>>,
173}
174
175impl<'a> DragDataItem<'a> {
176 pub fn builder(mimeType: impl Into<Cow<'a, str>>, data: impl Into<Cow<'a, str>>) -> DragDataItemBuilder<'a> {
177 DragDataItemBuilder {
178 mimeType: mimeType.into(),
179 data: data.into(),
180 title: None,
181 baseURL: None,
182 }
183 }
184 pub fn mimeType(&self) -> &str { self.mimeType.as_ref() }
185 pub fn data(&self) -> &str { self.data.as_ref() }
186 pub fn title(&self) -> Option<&str> { self.title.as_deref() }
187 pub fn baseURL(&self) -> Option<&str> { self.baseURL.as_deref() }
188}
189
190
191pub struct DragDataItemBuilder<'a> {
192 mimeType: Cow<'a, str>,
193 data: Cow<'a, str>,
194 title: Option<Cow<'a, str>>,
195 baseURL: Option<Cow<'a, str>>,
196}
197
198impl<'a> DragDataItemBuilder<'a> {
199 pub fn title(mut self, title: impl Into<Cow<'a, str>>) -> Self { self.title = Some(title.into()); self }
201 pub fn baseURL(mut self, baseURL: impl Into<Cow<'a, str>>) -> Self { self.baseURL = Some(baseURL.into()); self }
204 pub fn build(self) -> DragDataItem<'a> {
205 DragDataItem {
206 mimeType: self.mimeType,
207 data: self.data,
208 title: self.title,
209 baseURL: self.baseURL,
210 }
211 }
212}
213
214
215#[derive(Debug, Clone, Serialize, Deserialize, Default)]
216#[serde(rename_all = "camelCase")]
217pub struct DragData<'a> {
218 items: Vec<DragDataItem<'a>>,
219 #[serde(skip_serializing_if = "Option::is_none")]
221 files: Option<Vec<Cow<'a, str>>>,
222 dragOperationsMask: i64,
224}
225
226impl<'a> DragData<'a> {
227 pub fn builder(items: Vec<DragDataItem<'a>>, dragOperationsMask: i64) -> DragDataBuilder<'a> {
228 DragDataBuilder {
229 items: items,
230 files: None,
231 dragOperationsMask: dragOperationsMask,
232 }
233 }
234 pub fn items(&self) -> &[DragDataItem<'a>] { &self.items }
235 pub fn files(&self) -> Option<&[Cow<'a, str>]> { self.files.as_deref() }
236 pub fn dragOperationsMask(&self) -> i64 { self.dragOperationsMask }
237}
238
239
240pub struct DragDataBuilder<'a> {
241 items: Vec<DragDataItem<'a>>,
242 files: Option<Vec<Cow<'a, str>>>,
243 dragOperationsMask: i64,
244}
245
246impl<'a> DragDataBuilder<'a> {
247 pub fn files(mut self, files: Vec<Cow<'a, str>>) -> Self { self.files = Some(files); self }
249 pub fn build(self) -> DragData<'a> {
250 DragData {
251 items: self.items,
252 files: self.files,
253 dragOperationsMask: self.dragOperationsMask,
254 }
255 }
256}
257
258#[derive(Debug, Clone, Serialize, Deserialize, Default)]
261#[serde(rename_all = "camelCase")]
262pub struct DispatchDragEventParams<'a> {
263 #[serde(rename = "type")]
265 type_: Cow<'a, str>,
266 x: f64,
268 y: f64,
271 data: DragData<'a>,
272 #[serde(skip_serializing_if = "Option::is_none")]
275 modifiers: Option<i64>,
276}
277
278impl<'a> DispatchDragEventParams<'a> {
279 pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64, data: DragData<'a>) -> DispatchDragEventParamsBuilder<'a> {
280 DispatchDragEventParamsBuilder {
281 type_: type_.into(),
282 x: x,
283 y: y,
284 data: data,
285 modifiers: None,
286 }
287 }
288 pub fn type_(&self) -> &str { self.type_.as_ref() }
289 pub fn x(&self) -> f64 { self.x }
290 pub fn y(&self) -> f64 { self.y }
291 pub fn data(&self) -> &DragData<'a> { &self.data }
292 pub fn modifiers(&self) -> Option<i64> { self.modifiers }
293}
294
295
296pub struct DispatchDragEventParamsBuilder<'a> {
297 type_: Cow<'a, str>,
298 x: f64,
299 y: f64,
300 data: DragData<'a>,
301 modifiers: Option<i64>,
302}
303
304impl<'a> DispatchDragEventParamsBuilder<'a> {
305 pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
308 pub fn build(self) -> DispatchDragEventParams<'a> {
309 DispatchDragEventParams {
310 type_: self.type_,
311 x: self.x,
312 y: self.y,
313 data: self.data,
314 modifiers: self.modifiers,
315 }
316 }
317}
318
319impl<'a> DispatchDragEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchDragEvent"; }
320
321impl<'a> crate::CdpCommand<'a> for DispatchDragEventParams<'a> {
322 const METHOD: &'static str = "Input.dispatchDragEvent";
323 type Response = crate::EmptyReturns;
324}
325
326#[derive(Debug, Clone, Serialize, Deserialize, Default)]
329#[serde(rename_all = "camelCase")]
330pub struct DispatchKeyEventParams<'a> {
331 #[serde(rename = "type")]
333 type_: Cow<'a, str>,
334 #[serde(skip_serializing_if = "Option::is_none")]
337 modifiers: Option<i64>,
338 #[serde(skip_serializing_if = "Option::is_none")]
340 timestamp: Option<TimeSinceEpoch>,
341 #[serde(skip_serializing_if = "Option::is_none")]
344 text: Option<Cow<'a, str>>,
345 #[serde(skip_serializing_if = "Option::is_none")]
348 unmodifiedText: Option<Cow<'a, str>>,
349 #[serde(skip_serializing_if = "Option::is_none")]
351 keyIdentifier: Option<Cow<'a, str>>,
352 #[serde(skip_serializing_if = "Option::is_none")]
354 code: Option<Cow<'a, str>>,
355 #[serde(skip_serializing_if = "Option::is_none")]
358 key: Option<Cow<'a, str>>,
359 #[serde(skip_serializing_if = "Option::is_none")]
361 windowsVirtualKeyCode: Option<i64>,
362 #[serde(skip_serializing_if = "Option::is_none")]
364 nativeVirtualKeyCode: Option<i64>,
365 #[serde(skip_serializing_if = "Option::is_none")]
367 autoRepeat: Option<bool>,
368 #[serde(skip_serializing_if = "Option::is_none")]
370 isKeypad: Option<bool>,
371 #[serde(skip_serializing_if = "Option::is_none")]
373 isSystemKey: Option<bool>,
374 #[serde(skip_serializing_if = "Option::is_none")]
377 location: Option<i64>,
378 #[serde(skip_serializing_if = "Option::is_none")]
382 commands: Option<Vec<Cow<'a, str>>>,
383}
384
385impl<'a> DispatchKeyEventParams<'a> {
386 pub fn builder(type_: impl Into<Cow<'a, str>>) -> DispatchKeyEventParamsBuilder<'a> {
387 DispatchKeyEventParamsBuilder {
388 type_: type_.into(),
389 modifiers: None,
390 timestamp: None,
391 text: None,
392 unmodifiedText: None,
393 keyIdentifier: None,
394 code: None,
395 key: None,
396 windowsVirtualKeyCode: None,
397 nativeVirtualKeyCode: None,
398 autoRepeat: None,
399 isKeypad: None,
400 isSystemKey: None,
401 location: None,
402 commands: None,
403 }
404 }
405 pub fn type_(&self) -> &str { self.type_.as_ref() }
406 pub fn modifiers(&self) -> Option<i64> { self.modifiers }
407 pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
408 pub fn text(&self) -> Option<&str> { self.text.as_deref() }
409 pub fn unmodifiedText(&self) -> Option<&str> { self.unmodifiedText.as_deref() }
410 pub fn keyIdentifier(&self) -> Option<&str> { self.keyIdentifier.as_deref() }
411 pub fn code(&self) -> Option<&str> { self.code.as_deref() }
412 pub fn key(&self) -> Option<&str> { self.key.as_deref() }
413 pub fn windowsVirtualKeyCode(&self) -> Option<i64> { self.windowsVirtualKeyCode }
414 pub fn nativeVirtualKeyCode(&self) -> Option<i64> { self.nativeVirtualKeyCode }
415 pub fn autoRepeat(&self) -> Option<bool> { self.autoRepeat }
416 pub fn isKeypad(&self) -> Option<bool> { self.isKeypad }
417 pub fn isSystemKey(&self) -> Option<bool> { self.isSystemKey }
418 pub fn location(&self) -> Option<i64> { self.location }
419 pub fn commands(&self) -> Option<&[Cow<'a, str>]> { self.commands.as_deref() }
420}
421
422
423pub struct DispatchKeyEventParamsBuilder<'a> {
424 type_: Cow<'a, str>,
425 modifiers: Option<i64>,
426 timestamp: Option<TimeSinceEpoch>,
427 text: Option<Cow<'a, str>>,
428 unmodifiedText: Option<Cow<'a, str>>,
429 keyIdentifier: Option<Cow<'a, str>>,
430 code: Option<Cow<'a, str>>,
431 key: Option<Cow<'a, str>>,
432 windowsVirtualKeyCode: Option<i64>,
433 nativeVirtualKeyCode: Option<i64>,
434 autoRepeat: Option<bool>,
435 isKeypad: Option<bool>,
436 isSystemKey: Option<bool>,
437 location: Option<i64>,
438 commands: Option<Vec<Cow<'a, str>>>,
439}
440
441impl<'a> DispatchKeyEventParamsBuilder<'a> {
442 pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
445 pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
447 pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
450 pub fn unmodifiedText(mut self, unmodifiedText: impl Into<Cow<'a, str>>) -> Self { self.unmodifiedText = Some(unmodifiedText.into()); self }
453 pub fn keyIdentifier(mut self, keyIdentifier: impl Into<Cow<'a, str>>) -> Self { self.keyIdentifier = Some(keyIdentifier.into()); self }
455 pub fn code(mut self, code: impl Into<Cow<'a, str>>) -> Self { self.code = Some(code.into()); self }
457 pub fn key(mut self, key: impl Into<Cow<'a, str>>) -> Self { self.key = Some(key.into()); self }
460 pub fn windowsVirtualKeyCode(mut self, windowsVirtualKeyCode: i64) -> Self { self.windowsVirtualKeyCode = Some(windowsVirtualKeyCode); self }
462 pub fn nativeVirtualKeyCode(mut self, nativeVirtualKeyCode: i64) -> Self { self.nativeVirtualKeyCode = Some(nativeVirtualKeyCode); self }
464 pub fn autoRepeat(mut self, autoRepeat: bool) -> Self { self.autoRepeat = Some(autoRepeat); self }
466 pub fn isKeypad(mut self, isKeypad: bool) -> Self { self.isKeypad = Some(isKeypad); self }
468 pub fn isSystemKey(mut self, isSystemKey: bool) -> Self { self.isSystemKey = Some(isSystemKey); self }
470 pub fn location(mut self, location: i64) -> Self { self.location = Some(location); self }
473 pub fn commands(mut self, commands: Vec<Cow<'a, str>>) -> Self { self.commands = Some(commands); self }
477 pub fn build(self) -> DispatchKeyEventParams<'a> {
478 DispatchKeyEventParams {
479 type_: self.type_,
480 modifiers: self.modifiers,
481 timestamp: self.timestamp,
482 text: self.text,
483 unmodifiedText: self.unmodifiedText,
484 keyIdentifier: self.keyIdentifier,
485 code: self.code,
486 key: self.key,
487 windowsVirtualKeyCode: self.windowsVirtualKeyCode,
488 nativeVirtualKeyCode: self.nativeVirtualKeyCode,
489 autoRepeat: self.autoRepeat,
490 isKeypad: self.isKeypad,
491 isSystemKey: self.isSystemKey,
492 location: self.location,
493 commands: self.commands,
494 }
495 }
496}
497
498impl<'a> DispatchKeyEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchKeyEvent"; }
499
500impl<'a> crate::CdpCommand<'a> for DispatchKeyEventParams<'a> {
501 const METHOD: &'static str = "Input.dispatchKeyEvent";
502 type Response = crate::EmptyReturns;
503}
504
505#[derive(Debug, Clone, Serialize, Deserialize, Default)]
509#[serde(rename_all = "camelCase")]
510pub struct InsertTextParams<'a> {
511 text: Cow<'a, str>,
513}
514
515impl<'a> InsertTextParams<'a> {
516 pub fn builder(text: impl Into<Cow<'a, str>>) -> InsertTextParamsBuilder<'a> {
517 InsertTextParamsBuilder {
518 text: text.into(),
519 }
520 }
521 pub fn text(&self) -> &str { self.text.as_ref() }
522}
523
524
525pub struct InsertTextParamsBuilder<'a> {
526 text: Cow<'a, str>,
527}
528
529impl<'a> InsertTextParamsBuilder<'a> {
530 pub fn build(self) -> InsertTextParams<'a> {
531 InsertTextParams {
532 text: self.text,
533 }
534 }
535}
536
537impl<'a> InsertTextParams<'a> { pub const METHOD: &'static str = "Input.insertText"; }
538
539impl<'a> crate::CdpCommand<'a> for InsertTextParams<'a> {
540 const METHOD: &'static str = "Input.insertText";
541 type Response = crate::EmptyReturns;
542}
543
544#[derive(Debug, Clone, Serialize, Deserialize, Default)]
549#[serde(rename_all = "camelCase")]
550pub struct ImeSetCompositionParams<'a> {
551 text: Cow<'a, str>,
553 selectionStart: i64,
555 selectionEnd: i64,
557 #[serde(skip_serializing_if = "Option::is_none")]
559 replacementStart: Option<i64>,
560 #[serde(skip_serializing_if = "Option::is_none")]
562 replacementEnd: Option<i64>,
563}
564
565impl<'a> ImeSetCompositionParams<'a> {
566 pub fn builder(text: impl Into<Cow<'a, str>>, selectionStart: i64, selectionEnd: i64) -> ImeSetCompositionParamsBuilder<'a> {
567 ImeSetCompositionParamsBuilder {
568 text: text.into(),
569 selectionStart: selectionStart,
570 selectionEnd: selectionEnd,
571 replacementStart: None,
572 replacementEnd: None,
573 }
574 }
575 pub fn text(&self) -> &str { self.text.as_ref() }
576 pub fn selectionStart(&self) -> i64 { self.selectionStart }
577 pub fn selectionEnd(&self) -> i64 { self.selectionEnd }
578 pub fn replacementStart(&self) -> Option<i64> { self.replacementStart }
579 pub fn replacementEnd(&self) -> Option<i64> { self.replacementEnd }
580}
581
582
583pub struct ImeSetCompositionParamsBuilder<'a> {
584 text: Cow<'a, str>,
585 selectionStart: i64,
586 selectionEnd: i64,
587 replacementStart: Option<i64>,
588 replacementEnd: Option<i64>,
589}
590
591impl<'a> ImeSetCompositionParamsBuilder<'a> {
592 pub fn replacementStart(mut self, replacementStart: i64) -> Self { self.replacementStart = Some(replacementStart); self }
594 pub fn replacementEnd(mut self, replacementEnd: i64) -> Self { self.replacementEnd = Some(replacementEnd); self }
596 pub fn build(self) -> ImeSetCompositionParams<'a> {
597 ImeSetCompositionParams {
598 text: self.text,
599 selectionStart: self.selectionStart,
600 selectionEnd: self.selectionEnd,
601 replacementStart: self.replacementStart,
602 replacementEnd: self.replacementEnd,
603 }
604 }
605}
606
607impl<'a> ImeSetCompositionParams<'a> { pub const METHOD: &'static str = "Input.imeSetComposition"; }
608
609impl<'a> crate::CdpCommand<'a> for ImeSetCompositionParams<'a> {
610 const METHOD: &'static str = "Input.imeSetComposition";
611 type Response = crate::EmptyReturns;
612}
613
614#[derive(Debug, Clone, Serialize, Deserialize, Default)]
617#[serde(rename_all = "camelCase")]
618pub struct DispatchMouseEventParams<'a> {
619 #[serde(rename = "type")]
621 type_: Cow<'a, str>,
622 x: f64,
624 y: f64,
627 #[serde(skip_serializing_if = "Option::is_none")]
630 modifiers: Option<i64>,
631 #[serde(skip_serializing_if = "Option::is_none")]
633 timestamp: Option<TimeSinceEpoch>,
634 #[serde(skip_serializing_if = "Option::is_none")]
636 button: Option<MouseButton>,
637 #[serde(skip_serializing_if = "Option::is_none")]
640 buttons: Option<i64>,
641 #[serde(skip_serializing_if = "Option::is_none")]
643 clickCount: Option<u64>,
644 #[serde(skip_serializing_if = "Option::is_none")]
646 force: Option<f64>,
647 #[serde(skip_serializing_if = "Option::is_none")]
649 tangentialPressure: Option<f64>,
650 #[serde(skip_serializing_if = "Option::is_none")]
652 tiltX: Option<f64>,
653 #[serde(skip_serializing_if = "Option::is_none")]
655 tiltY: Option<f64>,
656 #[serde(skip_serializing_if = "Option::is_none")]
658 twist: Option<i64>,
659 #[serde(skip_serializing_if = "Option::is_none")]
661 deltaX: Option<f64>,
662 #[serde(skip_serializing_if = "Option::is_none")]
664 deltaY: Option<f64>,
665 #[serde(skip_serializing_if = "Option::is_none")]
667 pointerType: Option<Cow<'a, str>>,
668}
669
670impl<'a> DispatchMouseEventParams<'a> {
671 pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64) -> DispatchMouseEventParamsBuilder<'a> {
672 DispatchMouseEventParamsBuilder {
673 type_: type_.into(),
674 x: x,
675 y: y,
676 modifiers: None,
677 timestamp: None,
678 button: None,
679 buttons: None,
680 clickCount: None,
681 force: None,
682 tangentialPressure: None,
683 tiltX: None,
684 tiltY: None,
685 twist: None,
686 deltaX: None,
687 deltaY: None,
688 pointerType: None,
689 }
690 }
691 pub fn type_(&self) -> &str { self.type_.as_ref() }
692 pub fn x(&self) -> f64 { self.x }
693 pub fn y(&self) -> f64 { self.y }
694 pub fn modifiers(&self) -> Option<i64> { self.modifiers }
695 pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
696 pub fn button(&self) -> Option<&MouseButton> { self.button.as_ref() }
697 pub fn buttons(&self) -> Option<i64> { self.buttons }
698 pub fn clickCount(&self) -> Option<u64> { self.clickCount }
699 pub fn force(&self) -> Option<f64> { self.force }
700 pub fn tangentialPressure(&self) -> Option<f64> { self.tangentialPressure }
701 pub fn tiltX(&self) -> Option<f64> { self.tiltX }
702 pub fn tiltY(&self) -> Option<f64> { self.tiltY }
703 pub fn twist(&self) -> Option<i64> { self.twist }
704 pub fn deltaX(&self) -> Option<f64> { self.deltaX }
705 pub fn deltaY(&self) -> Option<f64> { self.deltaY }
706 pub fn pointerType(&self) -> Option<&str> { self.pointerType.as_deref() }
707}
708
709
710pub struct DispatchMouseEventParamsBuilder<'a> {
711 type_: Cow<'a, str>,
712 x: f64,
713 y: f64,
714 modifiers: Option<i64>,
715 timestamp: Option<TimeSinceEpoch>,
716 button: Option<MouseButton>,
717 buttons: Option<i64>,
718 clickCount: Option<u64>,
719 force: Option<f64>,
720 tangentialPressure: Option<f64>,
721 tiltX: Option<f64>,
722 tiltY: Option<f64>,
723 twist: Option<i64>,
724 deltaX: Option<f64>,
725 deltaY: Option<f64>,
726 pointerType: Option<Cow<'a, str>>,
727}
728
729impl<'a> DispatchMouseEventParamsBuilder<'a> {
730 pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
733 pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
735 pub fn button(mut self, button: MouseButton) -> Self { self.button = Some(button); self }
737 pub fn buttons(mut self, buttons: i64) -> Self { self.buttons = Some(buttons); self }
740 pub fn clickCount(mut self, clickCount: u64) -> Self { self.clickCount = Some(clickCount); self }
742 pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
744 pub fn tangentialPressure(mut self, tangentialPressure: f64) -> Self { self.tangentialPressure = Some(tangentialPressure); self }
746 pub fn tiltX(mut self, tiltX: f64) -> Self { self.tiltX = Some(tiltX); self }
748 pub fn tiltY(mut self, tiltY: f64) -> Self { self.tiltY = Some(tiltY); self }
750 pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
752 pub fn deltaX(mut self, deltaX: f64) -> Self { self.deltaX = Some(deltaX); self }
754 pub fn deltaY(mut self, deltaY: f64) -> Self { self.deltaY = Some(deltaY); self }
756 pub fn pointerType(mut self, pointerType: impl Into<Cow<'a, str>>) -> Self { self.pointerType = Some(pointerType.into()); self }
758 pub fn build(self) -> DispatchMouseEventParams<'a> {
759 DispatchMouseEventParams {
760 type_: self.type_,
761 x: self.x,
762 y: self.y,
763 modifiers: self.modifiers,
764 timestamp: self.timestamp,
765 button: self.button,
766 buttons: self.buttons,
767 clickCount: self.clickCount,
768 force: self.force,
769 tangentialPressure: self.tangentialPressure,
770 tiltX: self.tiltX,
771 tiltY: self.tiltY,
772 twist: self.twist,
773 deltaX: self.deltaX,
774 deltaY: self.deltaY,
775 pointerType: self.pointerType,
776 }
777 }
778}
779
780impl<'a> DispatchMouseEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchMouseEvent"; }
781
782impl<'a> crate::CdpCommand<'a> for DispatchMouseEventParams<'a> {
783 const METHOD: &'static str = "Input.dispatchMouseEvent";
784 type Response = crate::EmptyReturns;
785}
786
787#[derive(Debug, Clone, Serialize, Deserialize, Default)]
790#[serde(rename_all = "camelCase")]
791pub struct DispatchTouchEventParams<'a> {
792 #[serde(rename = "type")]
795 type_: Cow<'a, str>,
796 touchPoints: Vec<TouchPoint>,
800 #[serde(skip_serializing_if = "Option::is_none")]
803 modifiers: Option<i64>,
804 #[serde(skip_serializing_if = "Option::is_none")]
806 timestamp: Option<TimeSinceEpoch>,
807}
808
809impl<'a> DispatchTouchEventParams<'a> {
810 pub fn builder(type_: impl Into<Cow<'a, str>>, touchPoints: Vec<TouchPoint>) -> DispatchTouchEventParamsBuilder<'a> {
811 DispatchTouchEventParamsBuilder {
812 type_: type_.into(),
813 touchPoints: touchPoints,
814 modifiers: None,
815 timestamp: None,
816 }
817 }
818 pub fn type_(&self) -> &str { self.type_.as_ref() }
819 pub fn touchPoints(&self) -> &[TouchPoint] { &self.touchPoints }
820 pub fn modifiers(&self) -> Option<i64> { self.modifiers }
821 pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
822}
823
824
825pub struct DispatchTouchEventParamsBuilder<'a> {
826 type_: Cow<'a, str>,
827 touchPoints: Vec<TouchPoint>,
828 modifiers: Option<i64>,
829 timestamp: Option<TimeSinceEpoch>,
830}
831
832impl<'a> DispatchTouchEventParamsBuilder<'a> {
833 pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
836 pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
838 pub fn build(self) -> DispatchTouchEventParams<'a> {
839 DispatchTouchEventParams {
840 type_: self.type_,
841 touchPoints: self.touchPoints,
842 modifiers: self.modifiers,
843 timestamp: self.timestamp,
844 }
845 }
846}
847
848impl<'a> DispatchTouchEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchTouchEvent"; }
849
850impl<'a> crate::CdpCommand<'a> for DispatchTouchEventParams<'a> {
851 const METHOD: &'static str = "Input.dispatchTouchEvent";
852 type Response = crate::EmptyReturns;
853}
854
855#[derive(Debug, Clone, Serialize, Deserialize, Default)]
856pub struct CancelDraggingParams {}
857
858impl CancelDraggingParams { pub const METHOD: &'static str = "Input.cancelDragging"; }
859
860impl<'a> crate::CdpCommand<'a> for CancelDraggingParams {
861 const METHOD: &'static str = "Input.cancelDragging";
862 type Response = crate::EmptyReturns;
863}
864
865#[derive(Debug, Clone, Serialize, Deserialize, Default)]
868#[serde(rename_all = "camelCase")]
869pub struct EmulateTouchFromMouseEventParams<'a> {
870 #[serde(rename = "type")]
872 type_: Cow<'a, str>,
873 x: i32,
875 y: i32,
877 button: MouseButton,
879 #[serde(skip_serializing_if = "Option::is_none")]
881 timestamp: Option<TimeSinceEpoch>,
882 #[serde(skip_serializing_if = "Option::is_none")]
884 deltaX: Option<f64>,
885 #[serde(skip_serializing_if = "Option::is_none")]
887 deltaY: Option<f64>,
888 #[serde(skip_serializing_if = "Option::is_none")]
891 modifiers: Option<i64>,
892 #[serde(skip_serializing_if = "Option::is_none")]
894 clickCount: Option<u64>,
895}
896
897impl<'a> EmulateTouchFromMouseEventParams<'a> {
898 pub fn builder(type_: impl Into<Cow<'a, str>>, x: i32, y: i32, button: MouseButton) -> EmulateTouchFromMouseEventParamsBuilder<'a> {
899 EmulateTouchFromMouseEventParamsBuilder {
900 type_: type_.into(),
901 x: x,
902 y: y,
903 button: button,
904 timestamp: None,
905 deltaX: None,
906 deltaY: None,
907 modifiers: None,
908 clickCount: None,
909 }
910 }
911 pub fn type_(&self) -> &str { self.type_.as_ref() }
912 pub fn x(&self) -> i32 { self.x }
913 pub fn y(&self) -> i32 { self.y }
914 pub fn button(&self) -> &MouseButton { &self.button }
915 pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
916 pub fn deltaX(&self) -> Option<f64> { self.deltaX }
917 pub fn deltaY(&self) -> Option<f64> { self.deltaY }
918 pub fn modifiers(&self) -> Option<i64> { self.modifiers }
919 pub fn clickCount(&self) -> Option<u64> { self.clickCount }
920}
921
922
923pub struct EmulateTouchFromMouseEventParamsBuilder<'a> {
924 type_: Cow<'a, str>,
925 x: i32,
926 y: i32,
927 button: MouseButton,
928 timestamp: Option<TimeSinceEpoch>,
929 deltaX: Option<f64>,
930 deltaY: Option<f64>,
931 modifiers: Option<i64>,
932 clickCount: Option<u64>,
933}
934
935impl<'a> EmulateTouchFromMouseEventParamsBuilder<'a> {
936 pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
938 pub fn deltaX(mut self, deltaX: f64) -> Self { self.deltaX = Some(deltaX); self }
940 pub fn deltaY(mut self, deltaY: f64) -> Self { self.deltaY = Some(deltaY); self }
942 pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
945 pub fn clickCount(mut self, clickCount: u64) -> Self { self.clickCount = Some(clickCount); self }
947 pub fn build(self) -> EmulateTouchFromMouseEventParams<'a> {
948 EmulateTouchFromMouseEventParams {
949 type_: self.type_,
950 x: self.x,
951 y: self.y,
952 button: self.button,
953 timestamp: self.timestamp,
954 deltaX: self.deltaX,
955 deltaY: self.deltaY,
956 modifiers: self.modifiers,
957 clickCount: self.clickCount,
958 }
959 }
960}
961
962impl<'a> EmulateTouchFromMouseEventParams<'a> { pub const METHOD: &'static str = "Input.emulateTouchFromMouseEvent"; }
963
964impl<'a> crate::CdpCommand<'a> for EmulateTouchFromMouseEventParams<'a> {
965 const METHOD: &'static str = "Input.emulateTouchFromMouseEvent";
966 type Response = crate::EmptyReturns;
967}
968
969#[derive(Debug, Clone, Serialize, Deserialize, Default)]
972#[serde(rename_all = "camelCase")]
973pub struct SetIgnoreInputEventsParams {
974 ignore: bool,
976}
977
978impl SetIgnoreInputEventsParams {
979 pub fn builder(ignore: bool) -> SetIgnoreInputEventsParamsBuilder {
980 SetIgnoreInputEventsParamsBuilder {
981 ignore: ignore,
982 }
983 }
984 pub fn ignore(&self) -> bool { self.ignore }
985}
986
987
988pub struct SetIgnoreInputEventsParamsBuilder {
989 ignore: bool,
990}
991
992impl SetIgnoreInputEventsParamsBuilder {
993 pub fn build(self) -> SetIgnoreInputEventsParams {
994 SetIgnoreInputEventsParams {
995 ignore: self.ignore,
996 }
997 }
998}
999
1000impl SetIgnoreInputEventsParams { pub const METHOD: &'static str = "Input.setIgnoreInputEvents"; }
1001
1002impl<'a> crate::CdpCommand<'a> for SetIgnoreInputEventsParams {
1003 const METHOD: &'static str = "Input.setIgnoreInputEvents";
1004 type Response = crate::EmptyReturns;
1005}
1006
1007#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1011#[serde(rename_all = "camelCase")]
1012pub struct SetInterceptDragsParams {
1013 enabled: bool,
1014}
1015
1016impl SetInterceptDragsParams {
1017 pub fn builder(enabled: bool) -> SetInterceptDragsParamsBuilder {
1018 SetInterceptDragsParamsBuilder {
1019 enabled: enabled,
1020 }
1021 }
1022 pub fn enabled(&self) -> bool { self.enabled }
1023}
1024
1025
1026pub struct SetInterceptDragsParamsBuilder {
1027 enabled: bool,
1028}
1029
1030impl SetInterceptDragsParamsBuilder {
1031 pub fn build(self) -> SetInterceptDragsParams {
1032 SetInterceptDragsParams {
1033 enabled: self.enabled,
1034 }
1035 }
1036}
1037
1038impl SetInterceptDragsParams { pub const METHOD: &'static str = "Input.setInterceptDrags"; }
1039
1040impl<'a> crate::CdpCommand<'a> for SetInterceptDragsParams {
1041 const METHOD: &'static str = "Input.setInterceptDrags";
1042 type Response = crate::EmptyReturns;
1043}
1044
1045#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1048#[serde(rename_all = "camelCase")]
1049pub struct SynthesizePinchGestureParams {
1050 x: f64,
1052 y: f64,
1054 scaleFactor: f64,
1056 #[serde(skip_serializing_if = "Option::is_none")]
1058 relativeSpeed: Option<i64>,
1059 #[serde(skip_serializing_if = "Option::is_none")]
1062 gestureSourceType: Option<GestureSourceType>,
1063}
1064
1065impl SynthesizePinchGestureParams {
1066 pub fn builder(x: f64, y: f64, scaleFactor: f64) -> SynthesizePinchGestureParamsBuilder {
1067 SynthesizePinchGestureParamsBuilder {
1068 x: x,
1069 y: y,
1070 scaleFactor: scaleFactor,
1071 relativeSpeed: None,
1072 gestureSourceType: None,
1073 }
1074 }
1075 pub fn x(&self) -> f64 { self.x }
1076 pub fn y(&self) -> f64 { self.y }
1077 pub fn scaleFactor(&self) -> f64 { self.scaleFactor }
1078 pub fn relativeSpeed(&self) -> Option<i64> { self.relativeSpeed }
1079 pub fn gestureSourceType(&self) -> Option<&GestureSourceType> { self.gestureSourceType.as_ref() }
1080}
1081
1082
1083pub struct SynthesizePinchGestureParamsBuilder {
1084 x: f64,
1085 y: f64,
1086 scaleFactor: f64,
1087 relativeSpeed: Option<i64>,
1088 gestureSourceType: Option<GestureSourceType>,
1089}
1090
1091impl SynthesizePinchGestureParamsBuilder {
1092 pub fn relativeSpeed(mut self, relativeSpeed: i64) -> Self { self.relativeSpeed = Some(relativeSpeed); self }
1094 pub fn gestureSourceType(mut self, gestureSourceType: GestureSourceType) -> Self { self.gestureSourceType = Some(gestureSourceType); self }
1097 pub fn build(self) -> SynthesizePinchGestureParams {
1098 SynthesizePinchGestureParams {
1099 x: self.x,
1100 y: self.y,
1101 scaleFactor: self.scaleFactor,
1102 relativeSpeed: self.relativeSpeed,
1103 gestureSourceType: self.gestureSourceType,
1104 }
1105 }
1106}
1107
1108impl SynthesizePinchGestureParams { pub const METHOD: &'static str = "Input.synthesizePinchGesture"; }
1109
1110impl<'a> crate::CdpCommand<'a> for SynthesizePinchGestureParams {
1111 const METHOD: &'static str = "Input.synthesizePinchGesture";
1112 type Response = crate::EmptyReturns;
1113}
1114
1115#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1118#[serde(rename_all = "camelCase")]
1119pub struct SynthesizeScrollGestureParams<'a> {
1120 x: f64,
1122 y: f64,
1124 #[serde(skip_serializing_if = "Option::is_none")]
1126 xDistance: Option<f64>,
1127 #[serde(skip_serializing_if = "Option::is_none")]
1129 yDistance: Option<f64>,
1130 #[serde(skip_serializing_if = "Option::is_none")]
1133 xOverscroll: Option<f64>,
1134 #[serde(skip_serializing_if = "Option::is_none")]
1137 yOverscroll: Option<f64>,
1138 #[serde(skip_serializing_if = "Option::is_none")]
1140 preventFling: Option<bool>,
1141 #[serde(skip_serializing_if = "Option::is_none")]
1143 speed: Option<i64>,
1144 #[serde(skip_serializing_if = "Option::is_none")]
1147 gestureSourceType: Option<GestureSourceType>,
1148 #[serde(skip_serializing_if = "Option::is_none")]
1150 repeatCount: Option<u64>,
1151 #[serde(skip_serializing_if = "Option::is_none")]
1153 repeatDelayMs: Option<i64>,
1154 #[serde(skip_serializing_if = "Option::is_none")]
1156 interactionMarkerName: Option<Cow<'a, str>>,
1157}
1158
1159impl<'a> SynthesizeScrollGestureParams<'a> {
1160 pub fn builder(x: f64, y: f64) -> SynthesizeScrollGestureParamsBuilder<'a> {
1161 SynthesizeScrollGestureParamsBuilder {
1162 x: x,
1163 y: y,
1164 xDistance: None,
1165 yDistance: None,
1166 xOverscroll: None,
1167 yOverscroll: None,
1168 preventFling: None,
1169 speed: None,
1170 gestureSourceType: None,
1171 repeatCount: None,
1172 repeatDelayMs: None,
1173 interactionMarkerName: None,
1174 }
1175 }
1176 pub fn x(&self) -> f64 { self.x }
1177 pub fn y(&self) -> f64 { self.y }
1178 pub fn xDistance(&self) -> Option<f64> { self.xDistance }
1179 pub fn yDistance(&self) -> Option<f64> { self.yDistance }
1180 pub fn xOverscroll(&self) -> Option<f64> { self.xOverscroll }
1181 pub fn yOverscroll(&self) -> Option<f64> { self.yOverscroll }
1182 pub fn preventFling(&self) -> Option<bool> { self.preventFling }
1183 pub fn speed(&self) -> Option<i64> { self.speed }
1184 pub fn gestureSourceType(&self) -> Option<&GestureSourceType> { self.gestureSourceType.as_ref() }
1185 pub fn repeatCount(&self) -> Option<u64> { self.repeatCount }
1186 pub fn repeatDelayMs(&self) -> Option<i64> { self.repeatDelayMs }
1187 pub fn interactionMarkerName(&self) -> Option<&str> { self.interactionMarkerName.as_deref() }
1188}
1189
1190
1191pub struct SynthesizeScrollGestureParamsBuilder<'a> {
1192 x: f64,
1193 y: f64,
1194 xDistance: Option<f64>,
1195 yDistance: Option<f64>,
1196 xOverscroll: Option<f64>,
1197 yOverscroll: Option<f64>,
1198 preventFling: Option<bool>,
1199 speed: Option<i64>,
1200 gestureSourceType: Option<GestureSourceType>,
1201 repeatCount: Option<u64>,
1202 repeatDelayMs: Option<i64>,
1203 interactionMarkerName: Option<Cow<'a, str>>,
1204}
1205
1206impl<'a> SynthesizeScrollGestureParamsBuilder<'a> {
1207 pub fn xDistance(mut self, xDistance: f64) -> Self { self.xDistance = Some(xDistance); self }
1209 pub fn yDistance(mut self, yDistance: f64) -> Self { self.yDistance = Some(yDistance); self }
1211 pub fn xOverscroll(mut self, xOverscroll: f64) -> Self { self.xOverscroll = Some(xOverscroll); self }
1214 pub fn yOverscroll(mut self, yOverscroll: f64) -> Self { self.yOverscroll = Some(yOverscroll); self }
1217 pub fn preventFling(mut self, preventFling: bool) -> Self { self.preventFling = Some(preventFling); self }
1219 pub fn speed(mut self, speed: i64) -> Self { self.speed = Some(speed); self }
1221 pub fn gestureSourceType(mut self, gestureSourceType: GestureSourceType) -> Self { self.gestureSourceType = Some(gestureSourceType); self }
1224 pub fn repeatCount(mut self, repeatCount: u64) -> Self { self.repeatCount = Some(repeatCount); self }
1226 pub fn repeatDelayMs(mut self, repeatDelayMs: i64) -> Self { self.repeatDelayMs = Some(repeatDelayMs); self }
1228 pub fn interactionMarkerName(mut self, interactionMarkerName: impl Into<Cow<'a, str>>) -> Self { self.interactionMarkerName = Some(interactionMarkerName.into()); self }
1230 pub fn build(self) -> SynthesizeScrollGestureParams<'a> {
1231 SynthesizeScrollGestureParams {
1232 x: self.x,
1233 y: self.y,
1234 xDistance: self.xDistance,
1235 yDistance: self.yDistance,
1236 xOverscroll: self.xOverscroll,
1237 yOverscroll: self.yOverscroll,
1238 preventFling: self.preventFling,
1239 speed: self.speed,
1240 gestureSourceType: self.gestureSourceType,
1241 repeatCount: self.repeatCount,
1242 repeatDelayMs: self.repeatDelayMs,
1243 interactionMarkerName: self.interactionMarkerName,
1244 }
1245 }
1246}
1247
1248impl<'a> SynthesizeScrollGestureParams<'a> { pub const METHOD: &'static str = "Input.synthesizeScrollGesture"; }
1249
1250impl<'a> crate::CdpCommand<'a> for SynthesizeScrollGestureParams<'a> {
1251 const METHOD: &'static str = "Input.synthesizeScrollGesture";
1252 type Response = crate::EmptyReturns;
1253}
1254
1255#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1258#[serde(rename_all = "camelCase")]
1259pub struct SynthesizeTapGestureParams {
1260 x: f64,
1262 y: f64,
1264 #[serde(skip_serializing_if = "Option::is_none")]
1266 duration: Option<i64>,
1267 #[serde(skip_serializing_if = "Option::is_none")]
1269 tapCount: Option<u64>,
1270 #[serde(skip_serializing_if = "Option::is_none")]
1273 gestureSourceType: Option<GestureSourceType>,
1274}
1275
1276impl SynthesizeTapGestureParams {
1277 pub fn builder(x: f64, y: f64) -> SynthesizeTapGestureParamsBuilder {
1278 SynthesizeTapGestureParamsBuilder {
1279 x: x,
1280 y: y,
1281 duration: None,
1282 tapCount: None,
1283 gestureSourceType: None,
1284 }
1285 }
1286 pub fn x(&self) -> f64 { self.x }
1287 pub fn y(&self) -> f64 { self.y }
1288 pub fn duration(&self) -> Option<i64> { self.duration }
1289 pub fn tapCount(&self) -> Option<u64> { self.tapCount }
1290 pub fn gestureSourceType(&self) -> Option<&GestureSourceType> { self.gestureSourceType.as_ref() }
1291}
1292
1293
1294pub struct SynthesizeTapGestureParamsBuilder {
1295 x: f64,
1296 y: f64,
1297 duration: Option<i64>,
1298 tapCount: Option<u64>,
1299 gestureSourceType: Option<GestureSourceType>,
1300}
1301
1302impl SynthesizeTapGestureParamsBuilder {
1303 pub fn duration(mut self, duration: i64) -> Self { self.duration = Some(duration); self }
1305 pub fn tapCount(mut self, tapCount: u64) -> Self { self.tapCount = Some(tapCount); self }
1307 pub fn gestureSourceType(mut self, gestureSourceType: GestureSourceType) -> Self { self.gestureSourceType = Some(gestureSourceType); self }
1310 pub fn build(self) -> SynthesizeTapGestureParams {
1311 SynthesizeTapGestureParams {
1312 x: self.x,
1313 y: self.y,
1314 duration: self.duration,
1315 tapCount: self.tapCount,
1316 gestureSourceType: self.gestureSourceType,
1317 }
1318 }
1319}
1320
1321impl SynthesizeTapGestureParams { pub const METHOD: &'static str = "Input.synthesizeTapGesture"; }
1322
1323impl<'a> crate::CdpCommand<'a> for SynthesizeTapGestureParams {
1324 const METHOD: &'static str = "Input.synthesizeTapGesture";
1325 type Response = crate::EmptyReturns;
1326}