1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct Animation<'a> {
10 id: Cow<'a, str>,
12 name: Cow<'a, str>,
14 #[serde(rename = "pausedState")]
16 paused_state: bool,
17 #[serde(rename = "playState")]
19 play_state: Cow<'a, str>,
20 #[serde(rename = "playbackRate")]
22 playback_rate: f64,
23 #[serde(rename = "startTime")]
28 start_time: f64,
29 #[serde(rename = "currentTime")]
31 current_time: f64,
32 #[serde(rename = "type")]
34 type_: Cow<'a, str>,
35 #[serde(skip_serializing_if = "Option::is_none")]
37 source: Option<AnimationEffect<'a>>,
38 #[serde(skip_serializing_if = "Option::is_none", rename = "cssId")]
41 css_id: Option<Cow<'a, str>>,
42 #[serde(skip_serializing_if = "Option::is_none", rename = "viewOrScrollTimeline")]
44 view_or_scroll_timeline: Option<ViewOrScrollTimeline>,
45}
46
47impl<'a> Animation<'a> {
48 pub fn builder(id: impl Into<Cow<'a, str>>, name: impl Into<Cow<'a, str>>, paused_state: bool, play_state: impl Into<Cow<'a, str>>, playback_rate: f64, start_time: f64, current_time: f64, type_: impl Into<Cow<'a, str>>) -> AnimationBuilder<'a> {
58 AnimationBuilder {
59 id: id.into(),
60 name: name.into(),
61 paused_state: paused_state,
62 play_state: play_state.into(),
63 playback_rate: playback_rate,
64 start_time: start_time,
65 current_time: current_time,
66 type_: type_.into(),
67 source: None,
68 css_id: None,
69 view_or_scroll_timeline: None,
70 }
71 }
72 pub fn id(&self) -> &str { self.id.as_ref() }
74 pub fn name(&self) -> &str { self.name.as_ref() }
76 pub fn paused_state(&self) -> bool { self.paused_state }
78 pub fn play_state(&self) -> &str { self.play_state.as_ref() }
80 pub fn playback_rate(&self) -> f64 { self.playback_rate }
82 pub fn start_time(&self) -> f64 { self.start_time }
87 pub fn current_time(&self) -> f64 { self.current_time }
89 pub fn type_(&self) -> &str { self.type_.as_ref() }
91 pub fn source(&self) -> Option<&AnimationEffect<'a>> { self.source.as_ref() }
93 pub fn css_id(&self) -> Option<&str> { self.css_id.as_deref() }
96 pub fn view_or_scroll_timeline(&self) -> Option<&ViewOrScrollTimeline> { self.view_or_scroll_timeline.as_ref() }
98}
99
100
101pub struct AnimationBuilder<'a> {
102 id: Cow<'a, str>,
103 name: Cow<'a, str>,
104 paused_state: bool,
105 play_state: Cow<'a, str>,
106 playback_rate: f64,
107 start_time: f64,
108 current_time: f64,
109 type_: Cow<'a, str>,
110 source: Option<AnimationEffect<'a>>,
111 css_id: Option<Cow<'a, str>>,
112 view_or_scroll_timeline: Option<ViewOrScrollTimeline>,
113}
114
115impl<'a> AnimationBuilder<'a> {
116 pub fn source(mut self, source: AnimationEffect<'a>) -> Self { self.source = Some(source); self }
118 pub fn css_id(mut self, css_id: impl Into<Cow<'a, str>>) -> Self { self.css_id = Some(css_id.into()); self }
121 pub fn view_or_scroll_timeline(mut self, view_or_scroll_timeline: ViewOrScrollTimeline) -> Self { self.view_or_scroll_timeline = Some(view_or_scroll_timeline); self }
123 pub fn build(self) -> Animation<'a> {
124 Animation {
125 id: self.id,
126 name: self.name,
127 paused_state: self.paused_state,
128 play_state: self.play_state,
129 playback_rate: self.playback_rate,
130 start_time: self.start_time,
131 current_time: self.current_time,
132 type_: self.type_,
133 source: self.source,
134 css_id: self.css_id,
135 view_or_scroll_timeline: self.view_or_scroll_timeline,
136 }
137 }
138}
139
140#[derive(Debug, Clone, Serialize, Deserialize, Default)]
143#[serde(rename_all = "camelCase")]
144pub struct ViewOrScrollTimeline {
145 #[serde(skip_serializing_if = "Option::is_none", rename = "sourceNodeId")]
147 source_node_id: Option<crate::dom::BackendNodeId>,
148 #[serde(skip_serializing_if = "Option::is_none", rename = "startOffset")]
151 start_offset: Option<f64>,
152 #[serde(skip_serializing_if = "Option::is_none", rename = "endOffset")]
155 end_offset: Option<f64>,
156 #[serde(skip_serializing_if = "Option::is_none", rename = "subjectNodeId")]
160 subject_node_id: Option<crate::dom::BackendNodeId>,
161 axis: crate::dom::ScrollOrientation,
163}
164
165impl ViewOrScrollTimeline {
166 pub fn builder(axis: crate::dom::ScrollOrientation) -> ViewOrScrollTimelineBuilder {
169 ViewOrScrollTimelineBuilder {
170 source_node_id: None,
171 start_offset: None,
172 end_offset: None,
173 subject_node_id: None,
174 axis: axis,
175 }
176 }
177 pub fn source_node_id(&self) -> Option<&crate::dom::BackendNodeId> { self.source_node_id.as_ref() }
179 pub fn start_offset(&self) -> Option<f64> { self.start_offset }
182 pub fn end_offset(&self) -> Option<f64> { self.end_offset }
185 pub fn subject_node_id(&self) -> Option<&crate::dom::BackendNodeId> { self.subject_node_id.as_ref() }
189 pub fn axis(&self) -> &crate::dom::ScrollOrientation { &self.axis }
191}
192
193
194pub struct ViewOrScrollTimelineBuilder {
195 source_node_id: Option<crate::dom::BackendNodeId>,
196 start_offset: Option<f64>,
197 end_offset: Option<f64>,
198 subject_node_id: Option<crate::dom::BackendNodeId>,
199 axis: crate::dom::ScrollOrientation,
200}
201
202impl ViewOrScrollTimelineBuilder {
203 pub fn source_node_id(mut self, source_node_id: crate::dom::BackendNodeId) -> Self { self.source_node_id = Some(source_node_id); self }
205 pub fn start_offset(mut self, start_offset: f64) -> Self { self.start_offset = Some(start_offset); self }
208 pub fn end_offset(mut self, end_offset: f64) -> Self { self.end_offset = Some(end_offset); self }
211 pub fn subject_node_id(mut self, subject_node_id: crate::dom::BackendNodeId) -> Self { self.subject_node_id = Some(subject_node_id); self }
215 pub fn build(self) -> ViewOrScrollTimeline {
216 ViewOrScrollTimeline {
217 source_node_id: self.source_node_id,
218 start_offset: self.start_offset,
219 end_offset: self.end_offset,
220 subject_node_id: self.subject_node_id,
221 axis: self.axis,
222 }
223 }
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize, Default)]
229#[serde(rename_all = "camelCase")]
230pub struct AnimationEffect<'a> {
231 delay: f64,
233 #[serde(rename = "endDelay")]
235 end_delay: f64,
236 #[serde(rename = "iterationStart")]
238 iteration_start: f64,
239 #[serde(skip_serializing_if = "Option::is_none")]
241 iterations: Option<f64>,
242 duration: f64,
247 direction: Cow<'a, str>,
249 fill: Cow<'a, str>,
251 #[serde(skip_serializing_if = "Option::is_none", rename = "backendNodeId")]
253 backend_node_id: Option<crate::dom::BackendNodeId>,
254 #[serde(skip_serializing_if = "Option::is_none", rename = "keyframesRule")]
256 keyframes_rule: Option<KeyframesRule<'a>>,
257 easing: Cow<'a, str>,
259}
260
261impl<'a> AnimationEffect<'a> {
262 pub fn builder(delay: f64, end_delay: f64, iteration_start: f64, duration: f64, direction: impl Into<Cow<'a, str>>, fill: impl Into<Cow<'a, str>>, easing: impl Into<Cow<'a, str>>) -> AnimationEffectBuilder<'a> {
271 AnimationEffectBuilder {
272 delay: delay,
273 end_delay: end_delay,
274 iteration_start: iteration_start,
275 iterations: None,
276 duration: duration,
277 direction: direction.into(),
278 fill: fill.into(),
279 backend_node_id: None,
280 keyframes_rule: None,
281 easing: easing.into(),
282 }
283 }
284 pub fn delay(&self) -> f64 { self.delay }
286 pub fn end_delay(&self) -> f64 { self.end_delay }
288 pub fn iteration_start(&self) -> f64 { self.iteration_start }
290 pub fn iterations(&self) -> Option<f64> { self.iterations }
292 pub fn duration(&self) -> f64 { self.duration }
297 pub fn direction(&self) -> &str { self.direction.as_ref() }
299 pub fn fill(&self) -> &str { self.fill.as_ref() }
301 pub fn backend_node_id(&self) -> Option<&crate::dom::BackendNodeId> { self.backend_node_id.as_ref() }
303 pub fn keyframes_rule(&self) -> Option<&KeyframesRule<'a>> { self.keyframes_rule.as_ref() }
305 pub fn easing(&self) -> &str { self.easing.as_ref() }
307}
308
309
310pub struct AnimationEffectBuilder<'a> {
311 delay: f64,
312 end_delay: f64,
313 iteration_start: f64,
314 iterations: Option<f64>,
315 duration: f64,
316 direction: Cow<'a, str>,
317 fill: Cow<'a, str>,
318 backend_node_id: Option<crate::dom::BackendNodeId>,
319 keyframes_rule: Option<KeyframesRule<'a>>,
320 easing: Cow<'a, str>,
321}
322
323impl<'a> AnimationEffectBuilder<'a> {
324 pub fn iterations(mut self, iterations: f64) -> Self { self.iterations = Some(iterations); self }
326 pub fn backend_node_id(mut self, backend_node_id: crate::dom::BackendNodeId) -> Self { self.backend_node_id = Some(backend_node_id); self }
328 pub fn keyframes_rule(mut self, keyframes_rule: KeyframesRule<'a>) -> Self { self.keyframes_rule = Some(keyframes_rule); self }
330 pub fn build(self) -> AnimationEffect<'a> {
331 AnimationEffect {
332 delay: self.delay,
333 end_delay: self.end_delay,
334 iteration_start: self.iteration_start,
335 iterations: self.iterations,
336 duration: self.duration,
337 direction: self.direction,
338 fill: self.fill,
339 backend_node_id: self.backend_node_id,
340 keyframes_rule: self.keyframes_rule,
341 easing: self.easing,
342 }
343 }
344}
345
346#[derive(Debug, Clone, Serialize, Deserialize, Default)]
349#[serde(rename_all = "camelCase")]
350pub struct KeyframesRule<'a> {
351 #[serde(skip_serializing_if = "Option::is_none")]
353 name: Option<Cow<'a, str>>,
354 keyframes: Vec<KeyframeStyle<'a>>,
356}
357
358impl<'a> KeyframesRule<'a> {
359 pub fn builder(keyframes: Vec<KeyframeStyle<'a>>) -> KeyframesRuleBuilder<'a> {
362 KeyframesRuleBuilder {
363 name: None,
364 keyframes: keyframes,
365 }
366 }
367 pub fn name(&self) -> Option<&str> { self.name.as_deref() }
369 pub fn keyframes(&self) -> &[KeyframeStyle<'a>] { &self.keyframes }
371}
372
373
374pub struct KeyframesRuleBuilder<'a> {
375 name: Option<Cow<'a, str>>,
376 keyframes: Vec<KeyframeStyle<'a>>,
377}
378
379impl<'a> KeyframesRuleBuilder<'a> {
380 pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
382 pub fn build(self) -> KeyframesRule<'a> {
383 KeyframesRule {
384 name: self.name,
385 keyframes: self.keyframes,
386 }
387 }
388}
389
390#[derive(Debug, Clone, Serialize, Deserialize, Default)]
393#[serde(rename_all = "camelCase")]
394pub struct KeyframeStyle<'a> {
395 offset: Cow<'a, str>,
397 easing: Cow<'a, str>,
399}
400
401impl<'a> KeyframeStyle<'a> {
402 pub fn builder(offset: impl Into<Cow<'a, str>>, easing: impl Into<Cow<'a, str>>) -> KeyframeStyleBuilder<'a> {
406 KeyframeStyleBuilder {
407 offset: offset.into(),
408 easing: easing.into(),
409 }
410 }
411 pub fn offset(&self) -> &str { self.offset.as_ref() }
413 pub fn easing(&self) -> &str { self.easing.as_ref() }
415}
416
417
418pub struct KeyframeStyleBuilder<'a> {
419 offset: Cow<'a, str>,
420 easing: Cow<'a, str>,
421}
422
423impl<'a> KeyframeStyleBuilder<'a> {
424 pub fn build(self) -> KeyframeStyle<'a> {
425 KeyframeStyle {
426 offset: self.offset,
427 easing: self.easing,
428 }
429 }
430}
431
432#[derive(Debug, Clone, Serialize, Deserialize, Default)]
433pub struct DisableParams {}
434
435impl DisableParams { pub const METHOD: &'static str = "Animation.disable"; }
436
437impl<'a> crate::CdpCommand<'a> for DisableParams {
438 const METHOD: &'static str = "Animation.disable";
439 type Response = crate::EmptyReturns;
440}
441
442#[derive(Debug, Clone, Serialize, Deserialize, Default)]
443pub struct EnableParams {}
444
445impl EnableParams { pub const METHOD: &'static str = "Animation.enable"; }
446
447impl<'a> crate::CdpCommand<'a> for EnableParams {
448 const METHOD: &'static str = "Animation.enable";
449 type Response = crate::EmptyReturns;
450}
451
452#[derive(Debug, Clone, Serialize, Deserialize, Default)]
455#[serde(rename_all = "camelCase")]
456pub struct GetCurrentTimeParams<'a> {
457 id: Cow<'a, str>,
459}
460
461impl<'a> GetCurrentTimeParams<'a> {
462 pub fn builder(id: impl Into<Cow<'a, str>>) -> GetCurrentTimeParamsBuilder<'a> {
465 GetCurrentTimeParamsBuilder {
466 id: id.into(),
467 }
468 }
469 pub fn id(&self) -> &str { self.id.as_ref() }
471}
472
473
474pub struct GetCurrentTimeParamsBuilder<'a> {
475 id: Cow<'a, str>,
476}
477
478impl<'a> GetCurrentTimeParamsBuilder<'a> {
479 pub fn build(self) -> GetCurrentTimeParams<'a> {
480 GetCurrentTimeParams {
481 id: self.id,
482 }
483 }
484}
485
486#[derive(Debug, Clone, Serialize, Deserialize, Default)]
489#[serde(rename_all = "camelCase")]
490pub struct GetCurrentTimeReturns {
491 #[serde(rename = "currentTime")]
493 current_time: f64,
494}
495
496impl GetCurrentTimeReturns {
497 pub fn builder(current_time: f64) -> GetCurrentTimeReturnsBuilder {
500 GetCurrentTimeReturnsBuilder {
501 current_time: current_time,
502 }
503 }
504 pub fn current_time(&self) -> f64 { self.current_time }
506}
507
508
509pub struct GetCurrentTimeReturnsBuilder {
510 current_time: f64,
511}
512
513impl GetCurrentTimeReturnsBuilder {
514 pub fn build(self) -> GetCurrentTimeReturns {
515 GetCurrentTimeReturns {
516 current_time: self.current_time,
517 }
518 }
519}
520
521impl<'a> GetCurrentTimeParams<'a> { pub const METHOD: &'static str = "Animation.getCurrentTime"; }
522
523impl<'a> crate::CdpCommand<'a> for GetCurrentTimeParams<'a> {
524 const METHOD: &'static str = "Animation.getCurrentTime";
525 type Response = GetCurrentTimeReturns;
526}
527
528#[derive(Debug, Clone, Serialize, Deserialize, Default)]
531#[serde(rename_all = "camelCase")]
532pub struct GetPlaybackRateReturns {
533 #[serde(rename = "playbackRate")]
535 playback_rate: f64,
536}
537
538impl GetPlaybackRateReturns {
539 pub fn builder(playback_rate: f64) -> GetPlaybackRateReturnsBuilder {
542 GetPlaybackRateReturnsBuilder {
543 playback_rate: playback_rate,
544 }
545 }
546 pub fn playback_rate(&self) -> f64 { self.playback_rate }
548}
549
550
551pub struct GetPlaybackRateReturnsBuilder {
552 playback_rate: f64,
553}
554
555impl GetPlaybackRateReturnsBuilder {
556 pub fn build(self) -> GetPlaybackRateReturns {
557 GetPlaybackRateReturns {
558 playback_rate: self.playback_rate,
559 }
560 }
561}
562
563#[derive(Debug, Clone, Serialize, Deserialize, Default)]
564pub struct GetPlaybackRateParams {}
565
566impl GetPlaybackRateParams { pub const METHOD: &'static str = "Animation.getPlaybackRate"; }
567
568impl<'a> crate::CdpCommand<'a> for GetPlaybackRateParams {
569 const METHOD: &'static str = "Animation.getPlaybackRate";
570 type Response = GetPlaybackRateReturns;
571}
572
573#[derive(Debug, Clone, Serialize, Deserialize, Default)]
576#[serde(rename_all = "camelCase")]
577pub struct ReleaseAnimationsParams<'a> {
578 animations: Vec<Cow<'a, str>>,
580}
581
582impl<'a> ReleaseAnimationsParams<'a> {
583 pub fn builder(animations: Vec<Cow<'a, str>>) -> ReleaseAnimationsParamsBuilder<'a> {
586 ReleaseAnimationsParamsBuilder {
587 animations: animations,
588 }
589 }
590 pub fn animations(&self) -> &[Cow<'a, str>] { &self.animations }
592}
593
594
595pub struct ReleaseAnimationsParamsBuilder<'a> {
596 animations: Vec<Cow<'a, str>>,
597}
598
599impl<'a> ReleaseAnimationsParamsBuilder<'a> {
600 pub fn build(self) -> ReleaseAnimationsParams<'a> {
601 ReleaseAnimationsParams {
602 animations: self.animations,
603 }
604 }
605}
606
607impl<'a> ReleaseAnimationsParams<'a> { pub const METHOD: &'static str = "Animation.releaseAnimations"; }
608
609impl<'a> crate::CdpCommand<'a> for ReleaseAnimationsParams<'a> {
610 const METHOD: &'static str = "Animation.releaseAnimations";
611 type Response = crate::EmptyReturns;
612}
613
614#[derive(Debug, Clone, Serialize, Deserialize, Default)]
617#[serde(rename_all = "camelCase")]
618pub struct ResolveAnimationParams<'a> {
619 #[serde(rename = "animationId")]
621 animation_id: Cow<'a, str>,
622}
623
624impl<'a> ResolveAnimationParams<'a> {
625 pub fn builder(animation_id: impl Into<Cow<'a, str>>) -> ResolveAnimationParamsBuilder<'a> {
628 ResolveAnimationParamsBuilder {
629 animation_id: animation_id.into(),
630 }
631 }
632 pub fn animation_id(&self) -> &str { self.animation_id.as_ref() }
634}
635
636
637pub struct ResolveAnimationParamsBuilder<'a> {
638 animation_id: Cow<'a, str>,
639}
640
641impl<'a> ResolveAnimationParamsBuilder<'a> {
642 pub fn build(self) -> ResolveAnimationParams<'a> {
643 ResolveAnimationParams {
644 animation_id: self.animation_id,
645 }
646 }
647}
648
649#[derive(Debug, Clone, Serialize, Deserialize, Default)]
652#[serde(rename_all = "camelCase")]
653pub struct ResolveAnimationReturns {
654 #[serde(rename = "remoteObject")]
656 remote_object: crate::runtime::RemoteObject,
657}
658
659impl ResolveAnimationReturns {
660 pub fn builder(remote_object: crate::runtime::RemoteObject) -> ResolveAnimationReturnsBuilder {
663 ResolveAnimationReturnsBuilder {
664 remote_object: remote_object,
665 }
666 }
667 pub fn remote_object(&self) -> &crate::runtime::RemoteObject { &self.remote_object }
669}
670
671
672pub struct ResolveAnimationReturnsBuilder {
673 remote_object: crate::runtime::RemoteObject,
674}
675
676impl ResolveAnimationReturnsBuilder {
677 pub fn build(self) -> ResolveAnimationReturns {
678 ResolveAnimationReturns {
679 remote_object: self.remote_object,
680 }
681 }
682}
683
684impl<'a> ResolveAnimationParams<'a> { pub const METHOD: &'static str = "Animation.resolveAnimation"; }
685
686impl<'a> crate::CdpCommand<'a> for ResolveAnimationParams<'a> {
687 const METHOD: &'static str = "Animation.resolveAnimation";
688 type Response = ResolveAnimationReturns;
689}
690
691#[derive(Debug, Clone, Serialize, Deserialize, Default)]
694#[serde(rename_all = "camelCase")]
695pub struct SeekAnimationsParams<'a> {
696 animations: Vec<Cow<'a, str>>,
698 #[serde(rename = "currentTime")]
700 current_time: f64,
701}
702
703impl<'a> SeekAnimationsParams<'a> {
704 pub fn builder(animations: Vec<Cow<'a, str>>, current_time: f64) -> SeekAnimationsParamsBuilder<'a> {
708 SeekAnimationsParamsBuilder {
709 animations: animations,
710 current_time: current_time,
711 }
712 }
713 pub fn animations(&self) -> &[Cow<'a, str>] { &self.animations }
715 pub fn current_time(&self) -> f64 { self.current_time }
717}
718
719
720pub struct SeekAnimationsParamsBuilder<'a> {
721 animations: Vec<Cow<'a, str>>,
722 current_time: f64,
723}
724
725impl<'a> SeekAnimationsParamsBuilder<'a> {
726 pub fn build(self) -> SeekAnimationsParams<'a> {
727 SeekAnimationsParams {
728 animations: self.animations,
729 current_time: self.current_time,
730 }
731 }
732}
733
734impl<'a> SeekAnimationsParams<'a> { pub const METHOD: &'static str = "Animation.seekAnimations"; }
735
736impl<'a> crate::CdpCommand<'a> for SeekAnimationsParams<'a> {
737 const METHOD: &'static str = "Animation.seekAnimations";
738 type Response = crate::EmptyReturns;
739}
740
741#[derive(Debug, Clone, Serialize, Deserialize, Default)]
744#[serde(rename_all = "camelCase")]
745pub struct SetPausedParams<'a> {
746 animations: Vec<Cow<'a, str>>,
748 paused: bool,
750}
751
752impl<'a> SetPausedParams<'a> {
753 pub fn builder(animations: Vec<Cow<'a, str>>, paused: bool) -> SetPausedParamsBuilder<'a> {
757 SetPausedParamsBuilder {
758 animations: animations,
759 paused: paused,
760 }
761 }
762 pub fn animations(&self) -> &[Cow<'a, str>] { &self.animations }
764 pub fn paused(&self) -> bool { self.paused }
766}
767
768
769pub struct SetPausedParamsBuilder<'a> {
770 animations: Vec<Cow<'a, str>>,
771 paused: bool,
772}
773
774impl<'a> SetPausedParamsBuilder<'a> {
775 pub fn build(self) -> SetPausedParams<'a> {
776 SetPausedParams {
777 animations: self.animations,
778 paused: self.paused,
779 }
780 }
781}
782
783impl<'a> SetPausedParams<'a> { pub const METHOD: &'static str = "Animation.setPaused"; }
784
785impl<'a> crate::CdpCommand<'a> for SetPausedParams<'a> {
786 const METHOD: &'static str = "Animation.setPaused";
787 type Response = crate::EmptyReturns;
788}
789
790#[derive(Debug, Clone, Serialize, Deserialize, Default)]
793#[serde(rename_all = "camelCase")]
794pub struct SetPlaybackRateParams {
795 #[serde(rename = "playbackRate")]
797 playback_rate: f64,
798}
799
800impl SetPlaybackRateParams {
801 pub fn builder(playback_rate: f64) -> SetPlaybackRateParamsBuilder {
804 SetPlaybackRateParamsBuilder {
805 playback_rate: playback_rate,
806 }
807 }
808 pub fn playback_rate(&self) -> f64 { self.playback_rate }
810}
811
812
813pub struct SetPlaybackRateParamsBuilder {
814 playback_rate: f64,
815}
816
817impl SetPlaybackRateParamsBuilder {
818 pub fn build(self) -> SetPlaybackRateParams {
819 SetPlaybackRateParams {
820 playback_rate: self.playback_rate,
821 }
822 }
823}
824
825impl SetPlaybackRateParams { pub const METHOD: &'static str = "Animation.setPlaybackRate"; }
826
827impl<'a> crate::CdpCommand<'a> for SetPlaybackRateParams {
828 const METHOD: &'static str = "Animation.setPlaybackRate";
829 type Response = crate::EmptyReturns;
830}
831
832#[derive(Debug, Clone, Serialize, Deserialize, Default)]
835#[serde(rename_all = "camelCase")]
836pub struct SetTimingParams<'a> {
837 #[serde(rename = "animationId")]
839 animation_id: Cow<'a, str>,
840 duration: f64,
842 delay: f64,
844}
845
846impl<'a> SetTimingParams<'a> {
847 pub fn builder(animation_id: impl Into<Cow<'a, str>>, duration: f64, delay: f64) -> SetTimingParamsBuilder<'a> {
852 SetTimingParamsBuilder {
853 animation_id: animation_id.into(),
854 duration: duration,
855 delay: delay,
856 }
857 }
858 pub fn animation_id(&self) -> &str { self.animation_id.as_ref() }
860 pub fn duration(&self) -> f64 { self.duration }
862 pub fn delay(&self) -> f64 { self.delay }
864}
865
866
867pub struct SetTimingParamsBuilder<'a> {
868 animation_id: Cow<'a, str>,
869 duration: f64,
870 delay: f64,
871}
872
873impl<'a> SetTimingParamsBuilder<'a> {
874 pub fn build(self) -> SetTimingParams<'a> {
875 SetTimingParams {
876 animation_id: self.animation_id,
877 duration: self.duration,
878 delay: self.delay,
879 }
880 }
881}
882
883impl<'a> SetTimingParams<'a> { pub const METHOD: &'static str = "Animation.setTiming"; }
884
885impl<'a> crate::CdpCommand<'a> for SetTimingParams<'a> {
886 const METHOD: &'static str = "Animation.setTiming";
887 type Response = crate::EmptyReturns;
888}