1use super::commands::*;
2impl AddRule {
3 pub fn builder() -> AddRuleBuilder {
4 <AddRuleBuilder as Default>::default()
5 }
6}
7#[derive(Default, Clone)]
8pub struct AddRuleBuilder {
9 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
10 rule_text: Option<String>,
11 location: Option<super::types::SourceRange>,
12 node_for_property_syntax_validation: Option<crate::browser_protocol::dom::types::NodeId>,
13}
14impl AddRuleBuilder {
15 pub fn style_sheet_id(
16 mut self,
17 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
18 ) -> Self {
19 self.style_sheet_id = Some(style_sheet_id.into());
20 self
21 }
22 pub fn rule_text(mut self, rule_text: impl Into<String>) -> Self {
23 self.rule_text = Some(rule_text.into());
24 self
25 }
26 pub fn location(mut self, location: impl Into<super::types::SourceRange>) -> Self {
27 self.location = Some(location.into());
28 self
29 }
30 pub fn node_for_property_syntax_validation(
31 mut self,
32 node_for_property_syntax_validation: impl Into<crate::browser_protocol::dom::types::NodeId>,
33 ) -> Self {
34 self.node_for_property_syntax_validation = Some(node_for_property_syntax_validation.into());
35 self
36 }
37 pub fn build(self) -> Result<AddRule, String> {
38 Ok(AddRule {
39 method: AddRuleMethod::AddRule,
40 params: AddRuleParams {
41 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
42 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
43 })?,
44 rule_text: self.rule_text.ok_or_else(|| {
45 format!("Field `{}` is mandatory.", std::stringify!(rule_text))
46 })?,
47 location: self.location.ok_or_else(|| {
48 format!("Field `{}` is mandatory.", std::stringify!(location))
49 })?,
50 node_for_property_syntax_validation: self.node_for_property_syntax_validation,
51 },
52 })
53 }
54}
55impl CollectClassNames {
56 pub fn builder() -> CollectClassNamesBuilder {
57 <CollectClassNamesBuilder as Default>::default()
58 }
59}
60#[derive(Default, Clone)]
61pub struct CollectClassNamesBuilder {
62 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
63}
64impl CollectClassNamesBuilder {
65 pub fn style_sheet_id(
66 mut self,
67 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
68 ) -> Self {
69 self.style_sheet_id = Some(style_sheet_id.into());
70 self
71 }
72 pub fn build(self) -> Result<CollectClassNames, String> {
73 Ok(CollectClassNames {
74 method: CollectClassNamesMethod::CollectClassNames,
75 params: CollectClassNamesParams {
76 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
77 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
78 })?,
79 },
80 })
81 }
82}
83impl CreateStyleSheet {
84 pub fn builder() -> CreateStyleSheetBuilder {
85 <CreateStyleSheetBuilder as Default>::default()
86 }
87}
88#[derive(Default, Clone)]
89pub struct CreateStyleSheetBuilder {
90 frame_id: Option<crate::browser_protocol::page::types::FrameId>,
91 force: Option<bool>,
92}
93impl CreateStyleSheetBuilder {
94 pub fn frame_id(
95 mut self,
96 frame_id: impl Into<crate::browser_protocol::page::types::FrameId>,
97 ) -> Self {
98 self.frame_id = Some(frame_id.into());
99 self
100 }
101 pub fn force(mut self, force: impl Into<bool>) -> Self {
102 self.force = Some(force.into());
103 self
104 }
105 pub fn build(self) -> Result<CreateStyleSheet, String> {
106 Ok(CreateStyleSheet {
107 method: CreateStyleSheetMethod::CreateStyleSheet,
108 params: CreateStyleSheetParams {
109 frame_id: self.frame_id.ok_or_else(|| {
110 format!("Field `{}` is mandatory.", std::stringify!(frame_id))
111 })?,
112 force: self.force,
113 },
114 })
115 }
116}
117#[derive(Debug, Clone, Default)]
118pub struct DisableBuilder;
119impl DisableBuilder {
120 pub fn new() -> Self {
121 Self
122 }
123 pub fn build(self) -> Disable {
124 Disable {
125 method: DisableMethod::Disable,
126 params: DisableParams {},
127 }
128 }
129}
130impl Disable {
131 pub fn builder() -> DisableBuilder {
132 DisableBuilder
133 }
134}
135#[derive(Debug, Clone, Default)]
136pub struct EnableBuilder;
137impl EnableBuilder {
138 pub fn new() -> Self {
139 Self
140 }
141 pub fn build(self) -> Enable {
142 Enable {
143 method: EnableMethod::Enable,
144 params: EnableParams {},
145 }
146 }
147}
148impl Enable {
149 pub fn builder() -> EnableBuilder {
150 EnableBuilder
151 }
152}
153impl ForcePseudoState {
154 pub fn builder() -> ForcePseudoStateBuilder {
155 <ForcePseudoStateBuilder as Default>::default()
156 }
157}
158#[derive(Default, Clone)]
159pub struct ForcePseudoStateBuilder {
160 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
161 forced_pseudo_classes: Option<Vec<String>>,
162}
163impl ForcePseudoStateBuilder {
164 pub fn node_id(
165 mut self,
166 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
167 ) -> Self {
168 self.node_id = Some(node_id.into());
169 self
170 }
171 pub fn forced_pseudo_classe(mut self, forced_pseudo_classe: impl Into<String>) -> Self {
172 let v = self.forced_pseudo_classes.get_or_insert(Vec::new());
173 v.push(forced_pseudo_classe.into());
174 self
175 }
176 pub fn forced_pseudo_classes<I, S>(mut self, forced_pseudo_classes: I) -> Self
177 where
178 I: IntoIterator<Item = S>,
179 S: Into<String>,
180 {
181 let v = self.forced_pseudo_classes.get_or_insert(Vec::new());
182 for val in forced_pseudo_classes {
183 v.push(val.into());
184 }
185 self
186 }
187 pub fn build(self) -> Result<ForcePseudoState, String> {
188 Ok(ForcePseudoState {
189 method: ForcePseudoStateMethod::ForcePseudoState,
190 params: ForcePseudoStateParams {
191 node_id: self
192 .node_id
193 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
194 forced_pseudo_classes: self.forced_pseudo_classes.ok_or_else(|| {
195 format!(
196 "Field `{}` is mandatory.",
197 std::stringify!(forced_pseudo_classes)
198 )
199 })?,
200 },
201 })
202 }
203}
204impl ForceStartingStyle {
205 pub fn builder() -> ForceStartingStyleBuilder {
206 <ForceStartingStyleBuilder as Default>::default()
207 }
208}
209#[derive(Default, Clone)]
210pub struct ForceStartingStyleBuilder {
211 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
212 forced: Option<bool>,
213}
214impl ForceStartingStyleBuilder {
215 pub fn node_id(
216 mut self,
217 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
218 ) -> Self {
219 self.node_id = Some(node_id.into());
220 self
221 }
222 pub fn forced(mut self, forced: impl Into<bool>) -> Self {
223 self.forced = Some(forced.into());
224 self
225 }
226 pub fn build(self) -> Result<ForceStartingStyle, String> {
227 Ok(ForceStartingStyle {
228 method: ForceStartingStyleMethod::ForceStartingStyle,
229 params: ForceStartingStyleParams {
230 node_id: self
231 .node_id
232 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
233 forced: self
234 .forced
235 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(forced)))?,
236 },
237 })
238 }
239}
240impl GetBackgroundColors {
241 pub fn builder() -> GetBackgroundColorsBuilder {
242 <GetBackgroundColorsBuilder as Default>::default()
243 }
244}
245#[derive(Default, Clone)]
246pub struct GetBackgroundColorsBuilder {
247 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
248}
249impl GetBackgroundColorsBuilder {
250 pub fn node_id(
251 mut self,
252 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
253 ) -> Self {
254 self.node_id = Some(node_id.into());
255 self
256 }
257 pub fn build(self) -> Result<GetBackgroundColors, String> {
258 Ok(GetBackgroundColors {
259 method: GetBackgroundColorsMethod::GetBackgroundColors,
260 params: GetBackgroundColorsParams {
261 node_id: self
262 .node_id
263 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
264 },
265 })
266 }
267}
268impl GetComputedStyleForNode {
269 pub fn builder() -> GetComputedStyleForNodeBuilder {
270 <GetComputedStyleForNodeBuilder as Default>::default()
271 }
272}
273#[derive(Default, Clone)]
274pub struct GetComputedStyleForNodeBuilder {
275 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
276}
277impl GetComputedStyleForNodeBuilder {
278 pub fn node_id(
279 mut self,
280 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
281 ) -> Self {
282 self.node_id = Some(node_id.into());
283 self
284 }
285 pub fn build(self) -> Result<GetComputedStyleForNode, String> {
286 Ok(GetComputedStyleForNode {
287 method: GetComputedStyleForNodeMethod::GetComputedStyleForNode,
288 params: GetComputedStyleForNodeParams {
289 node_id: self
290 .node_id
291 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
292 },
293 })
294 }
295}
296impl ResolveValues {
297 pub fn builder() -> ResolveValuesBuilder {
298 <ResolveValuesBuilder as Default>::default()
299 }
300}
301#[derive(Default, Clone)]
302pub struct ResolveValuesBuilder {
303 values: Option<Vec<String>>,
304 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
305 property_name: Option<String>,
306 pseudo_type: Option<crate::browser_protocol::dom::types::PseudoType>,
307 pseudo_identifier: Option<String>,
308}
309impl ResolveValuesBuilder {
310 pub fn value(mut self, value: impl Into<String>) -> Self {
311 let v = self.values.get_or_insert(Vec::new());
312 v.push(value.into());
313 self
314 }
315 pub fn values<I, S>(mut self, values: I) -> Self
316 where
317 I: IntoIterator<Item = S>,
318 S: Into<String>,
319 {
320 let v = self.values.get_or_insert(Vec::new());
321 for val in values {
322 v.push(val.into());
323 }
324 self
325 }
326 pub fn node_id(
327 mut self,
328 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
329 ) -> Self {
330 self.node_id = Some(node_id.into());
331 self
332 }
333 pub fn property_name(mut self, property_name: impl Into<String>) -> Self {
334 self.property_name = Some(property_name.into());
335 self
336 }
337 pub fn pseudo_type(
338 mut self,
339 pseudo_type: impl Into<crate::browser_protocol::dom::types::PseudoType>,
340 ) -> Self {
341 self.pseudo_type = Some(pseudo_type.into());
342 self
343 }
344 pub fn pseudo_identifier(mut self, pseudo_identifier: impl Into<String>) -> Self {
345 self.pseudo_identifier = Some(pseudo_identifier.into());
346 self
347 }
348 pub fn build(self) -> Result<ResolveValues, String> {
349 Ok(ResolveValues {
350 method: ResolveValuesMethod::ResolveValues,
351 params: ResolveValuesParams {
352 values: self
353 .values
354 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(values)))?,
355 node_id: self
356 .node_id
357 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
358 property_name: self.property_name,
359 pseudo_type: self.pseudo_type,
360 pseudo_identifier: self.pseudo_identifier,
361 },
362 })
363 }
364}
365impl GetLonghandProperties {
366 pub fn builder() -> GetLonghandPropertiesBuilder {
367 <GetLonghandPropertiesBuilder as Default>::default()
368 }
369}
370#[derive(Default, Clone)]
371pub struct GetLonghandPropertiesBuilder {
372 shorthand_name: Option<String>,
373 value: Option<String>,
374}
375impl GetLonghandPropertiesBuilder {
376 pub fn shorthand_name(mut self, shorthand_name: impl Into<String>) -> Self {
377 self.shorthand_name = Some(shorthand_name.into());
378 self
379 }
380 pub fn value(mut self, value: impl Into<String>) -> Self {
381 self.value = Some(value.into());
382 self
383 }
384 pub fn build(self) -> Result<GetLonghandProperties, String> {
385 Ok(GetLonghandProperties {
386 method: GetLonghandPropertiesMethod::GetLonghandProperties,
387 params: GetLonghandPropertiesParams {
388 shorthand_name: self.shorthand_name.ok_or_else(|| {
389 format!("Field `{}` is mandatory.", std::stringify!(shorthand_name))
390 })?,
391 value: self
392 .value
393 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(value)))?,
394 },
395 })
396 }
397}
398impl GetInlineStylesForNode {
399 pub fn builder() -> GetInlineStylesForNodeBuilder {
400 <GetInlineStylesForNodeBuilder as Default>::default()
401 }
402}
403#[derive(Default, Clone)]
404pub struct GetInlineStylesForNodeBuilder {
405 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
406}
407impl GetInlineStylesForNodeBuilder {
408 pub fn node_id(
409 mut self,
410 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
411 ) -> Self {
412 self.node_id = Some(node_id.into());
413 self
414 }
415 pub fn build(self) -> Result<GetInlineStylesForNode, String> {
416 Ok(GetInlineStylesForNode {
417 method: GetInlineStylesForNodeMethod::GetInlineStylesForNode,
418 params: GetInlineStylesForNodeParams {
419 node_id: self
420 .node_id
421 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
422 },
423 })
424 }
425}
426impl GetAnimatedStylesForNode {
427 pub fn builder() -> GetAnimatedStylesForNodeBuilder {
428 <GetAnimatedStylesForNodeBuilder as Default>::default()
429 }
430}
431#[derive(Default, Clone)]
432pub struct GetAnimatedStylesForNodeBuilder {
433 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
434}
435impl GetAnimatedStylesForNodeBuilder {
436 pub fn node_id(
437 mut self,
438 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
439 ) -> Self {
440 self.node_id = Some(node_id.into());
441 self
442 }
443 pub fn build(self) -> Result<GetAnimatedStylesForNode, String> {
444 Ok(GetAnimatedStylesForNode {
445 method: GetAnimatedStylesForNodeMethod::GetAnimatedStylesForNode,
446 params: GetAnimatedStylesForNodeParams {
447 node_id: self
448 .node_id
449 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
450 },
451 })
452 }
453}
454impl GetMatchedStylesForNode {
455 pub fn builder() -> GetMatchedStylesForNodeBuilder {
456 <GetMatchedStylesForNodeBuilder as Default>::default()
457 }
458}
459#[derive(Default, Clone)]
460pub struct GetMatchedStylesForNodeBuilder {
461 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
462}
463impl GetMatchedStylesForNodeBuilder {
464 pub fn node_id(
465 mut self,
466 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
467 ) -> Self {
468 self.node_id = Some(node_id.into());
469 self
470 }
471 pub fn build(self) -> Result<GetMatchedStylesForNode, String> {
472 Ok(GetMatchedStylesForNode {
473 method: GetMatchedStylesForNodeMethod::GetMatchedStylesForNode,
474 params: GetMatchedStylesForNodeParams {
475 node_id: self
476 .node_id
477 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
478 },
479 })
480 }
481}
482#[derive(Debug, Clone, Default)]
483pub struct GetEnvironmentVariablesBuilder;
484impl GetEnvironmentVariablesBuilder {
485 pub fn new() -> Self {
486 Self
487 }
488 pub fn build(self) -> GetEnvironmentVariables {
489 GetEnvironmentVariables {
490 method: GetEnvironmentVariablesMethod::GetEnvironmentVariables,
491 params: GetEnvironmentVariablesParams {},
492 }
493 }
494}
495impl GetEnvironmentVariables {
496 pub fn builder() -> GetEnvironmentVariablesBuilder {
497 GetEnvironmentVariablesBuilder
498 }
499}
500#[derive(Debug, Clone, Default)]
501pub struct GetMediaQueriesBuilder;
502impl GetMediaQueriesBuilder {
503 pub fn new() -> Self {
504 Self
505 }
506 pub fn build(self) -> GetMediaQueries {
507 GetMediaQueries {
508 method: GetMediaQueriesMethod::GetMediaQueries,
509 params: GetMediaQueriesParams {},
510 }
511 }
512}
513impl GetMediaQueries {
514 pub fn builder() -> GetMediaQueriesBuilder {
515 GetMediaQueriesBuilder
516 }
517}
518impl GetPlatformFontsForNode {
519 pub fn builder() -> GetPlatformFontsForNodeBuilder {
520 <GetPlatformFontsForNodeBuilder as Default>::default()
521 }
522}
523#[derive(Default, Clone)]
524pub struct GetPlatformFontsForNodeBuilder {
525 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
526}
527impl GetPlatformFontsForNodeBuilder {
528 pub fn node_id(
529 mut self,
530 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
531 ) -> Self {
532 self.node_id = Some(node_id.into());
533 self
534 }
535 pub fn build(self) -> Result<GetPlatformFontsForNode, String> {
536 Ok(GetPlatformFontsForNode {
537 method: GetPlatformFontsForNodeMethod::GetPlatformFontsForNode,
538 params: GetPlatformFontsForNodeParams {
539 node_id: self
540 .node_id
541 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
542 },
543 })
544 }
545}
546impl GetStyleSheetText {
547 pub fn builder() -> GetStyleSheetTextBuilder {
548 <GetStyleSheetTextBuilder as Default>::default()
549 }
550}
551#[derive(Default, Clone)]
552pub struct GetStyleSheetTextBuilder {
553 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
554}
555impl GetStyleSheetTextBuilder {
556 pub fn style_sheet_id(
557 mut self,
558 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
559 ) -> Self {
560 self.style_sheet_id = Some(style_sheet_id.into());
561 self
562 }
563 pub fn build(self) -> Result<GetStyleSheetText, String> {
564 Ok(GetStyleSheetText {
565 method: GetStyleSheetTextMethod::GetStyleSheetText,
566 params: GetStyleSheetTextParams {
567 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
568 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
569 })?,
570 },
571 })
572 }
573}
574impl GetLayersForNode {
575 pub fn builder() -> GetLayersForNodeBuilder {
576 <GetLayersForNodeBuilder as Default>::default()
577 }
578}
579#[derive(Default, Clone)]
580pub struct GetLayersForNodeBuilder {
581 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
582}
583impl GetLayersForNodeBuilder {
584 pub fn node_id(
585 mut self,
586 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
587 ) -> Self {
588 self.node_id = Some(node_id.into());
589 self
590 }
591 pub fn build(self) -> Result<GetLayersForNode, String> {
592 Ok(GetLayersForNode {
593 method: GetLayersForNodeMethod::GetLayersForNode,
594 params: GetLayersForNodeParams {
595 node_id: self
596 .node_id
597 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
598 },
599 })
600 }
601}
602impl GetLocationForSelector {
603 pub fn builder() -> GetLocationForSelectorBuilder {
604 <GetLocationForSelectorBuilder as Default>::default()
605 }
606}
607#[derive(Default, Clone)]
608pub struct GetLocationForSelectorBuilder {
609 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
610 selector_text: Option<String>,
611}
612impl GetLocationForSelectorBuilder {
613 pub fn style_sheet_id(
614 mut self,
615 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
616 ) -> Self {
617 self.style_sheet_id = Some(style_sheet_id.into());
618 self
619 }
620 pub fn selector_text(mut self, selector_text: impl Into<String>) -> Self {
621 self.selector_text = Some(selector_text.into());
622 self
623 }
624 pub fn build(self) -> Result<GetLocationForSelector, String> {
625 Ok(GetLocationForSelector {
626 method: GetLocationForSelectorMethod::GetLocationForSelector,
627 params: GetLocationForSelectorParams {
628 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
629 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
630 })?,
631 selector_text: self.selector_text.ok_or_else(|| {
632 format!("Field `{}` is mandatory.", std::stringify!(selector_text))
633 })?,
634 },
635 })
636 }
637}
638impl TrackComputedStyleUpdatesForNode {
639 pub fn builder() -> TrackComputedStyleUpdatesForNodeBuilder {
640 <TrackComputedStyleUpdatesForNodeBuilder as Default>::default()
641 }
642}
643#[derive(Default, Clone)]
644pub struct TrackComputedStyleUpdatesForNodeBuilder {
645 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
646}
647impl TrackComputedStyleUpdatesForNodeBuilder {
648 pub fn node_id(
649 mut self,
650 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
651 ) -> Self {
652 self.node_id = Some(node_id.into());
653 self
654 }
655 pub fn build(self) -> TrackComputedStyleUpdatesForNode {
656 TrackComputedStyleUpdatesForNode {
657 method: TrackComputedStyleUpdatesForNodeMethod::TrackComputedStyleUpdatesForNode,
658 params: TrackComputedStyleUpdatesForNodeParams {
659 node_id: self.node_id,
660 },
661 }
662 }
663}
664impl TrackComputedStyleUpdates {
665 pub fn builder() -> TrackComputedStyleUpdatesBuilder {
666 <TrackComputedStyleUpdatesBuilder as Default>::default()
667 }
668}
669#[derive(Default, Clone)]
670pub struct TrackComputedStyleUpdatesBuilder {
671 properties_to_track: Option<Vec<super::types::CssComputedStyleProperty>>,
672}
673impl TrackComputedStyleUpdatesBuilder {
674 pub fn properties_to_track(
675 mut self,
676 properties_to_track: impl Into<super::types::CssComputedStyleProperty>,
677 ) -> Self {
678 let v = self.properties_to_track.get_or_insert(Vec::new());
679 v.push(properties_to_track.into());
680 self
681 }
682 pub fn properties_to_tracks<I, S>(mut self, properties_to_tracks: I) -> Self
683 where
684 I: IntoIterator<Item = S>,
685 S: Into<super::types::CssComputedStyleProperty>,
686 {
687 let v = self.properties_to_track.get_or_insert(Vec::new());
688 for val in properties_to_tracks {
689 v.push(val.into());
690 }
691 self
692 }
693 pub fn build(self) -> Result<TrackComputedStyleUpdates, String> {
694 Ok(TrackComputedStyleUpdates {
695 method: TrackComputedStyleUpdatesMethod::TrackComputedStyleUpdates,
696 params: TrackComputedStyleUpdatesParams {
697 properties_to_track: self.properties_to_track.ok_or_else(|| {
698 format!(
699 "Field `{}` is mandatory.",
700 std::stringify!(properties_to_track)
701 )
702 })?,
703 },
704 })
705 }
706}
707#[derive(Debug, Clone, Default)]
708pub struct TakeComputedStyleUpdatesBuilder;
709impl TakeComputedStyleUpdatesBuilder {
710 pub fn new() -> Self {
711 Self
712 }
713 pub fn build(self) -> TakeComputedStyleUpdates {
714 TakeComputedStyleUpdates {
715 method: TakeComputedStyleUpdatesMethod::TakeComputedStyleUpdates,
716 params: TakeComputedStyleUpdatesParams {},
717 }
718 }
719}
720impl TakeComputedStyleUpdates {
721 pub fn builder() -> TakeComputedStyleUpdatesBuilder {
722 TakeComputedStyleUpdatesBuilder
723 }
724}
725impl SetEffectivePropertyValueForNode {
726 pub fn builder() -> SetEffectivePropertyValueForNodeBuilder {
727 <SetEffectivePropertyValueForNodeBuilder as Default>::default()
728 }
729}
730#[derive(Default, Clone)]
731pub struct SetEffectivePropertyValueForNodeBuilder {
732 node_id: Option<crate::browser_protocol::dom::types::NodeId>,
733 property_name: Option<String>,
734 value: Option<String>,
735}
736impl SetEffectivePropertyValueForNodeBuilder {
737 pub fn node_id(
738 mut self,
739 node_id: impl Into<crate::browser_protocol::dom::types::NodeId>,
740 ) -> Self {
741 self.node_id = Some(node_id.into());
742 self
743 }
744 pub fn property_name(mut self, property_name: impl Into<String>) -> Self {
745 self.property_name = Some(property_name.into());
746 self
747 }
748 pub fn value(mut self, value: impl Into<String>) -> Self {
749 self.value = Some(value.into());
750 self
751 }
752 pub fn build(self) -> Result<SetEffectivePropertyValueForNode, String> {
753 Ok(SetEffectivePropertyValueForNode {
754 method: SetEffectivePropertyValueForNodeMethod::SetEffectivePropertyValueForNode,
755 params: SetEffectivePropertyValueForNodeParams {
756 node_id: self
757 .node_id
758 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(node_id)))?,
759 property_name: self.property_name.ok_or_else(|| {
760 format!("Field `{}` is mandatory.", std::stringify!(property_name))
761 })?,
762 value: self
763 .value
764 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(value)))?,
765 },
766 })
767 }
768}
769impl SetPropertyRulePropertyName {
770 pub fn builder() -> SetPropertyRulePropertyNameBuilder {
771 <SetPropertyRulePropertyNameBuilder as Default>::default()
772 }
773}
774#[derive(Default, Clone)]
775pub struct SetPropertyRulePropertyNameBuilder {
776 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
777 range: Option<super::types::SourceRange>,
778 property_name: Option<String>,
779}
780impl SetPropertyRulePropertyNameBuilder {
781 pub fn style_sheet_id(
782 mut self,
783 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
784 ) -> Self {
785 self.style_sheet_id = Some(style_sheet_id.into());
786 self
787 }
788 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
789 self.range = Some(range.into());
790 self
791 }
792 pub fn property_name(mut self, property_name: impl Into<String>) -> Self {
793 self.property_name = Some(property_name.into());
794 self
795 }
796 pub fn build(self) -> Result<SetPropertyRulePropertyName, String> {
797 Ok(SetPropertyRulePropertyName {
798 method: SetPropertyRulePropertyNameMethod::SetPropertyRulePropertyName,
799 params: SetPropertyRulePropertyNameParams {
800 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
801 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
802 })?,
803 range: self
804 .range
805 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
806 property_name: self.property_name.ok_or_else(|| {
807 format!("Field `{}` is mandatory.", std::stringify!(property_name))
808 })?,
809 },
810 })
811 }
812}
813impl SetKeyframeKey {
814 pub fn builder() -> SetKeyframeKeyBuilder {
815 <SetKeyframeKeyBuilder as Default>::default()
816 }
817}
818#[derive(Default, Clone)]
819pub struct SetKeyframeKeyBuilder {
820 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
821 range: Option<super::types::SourceRange>,
822 key_text: Option<String>,
823}
824impl SetKeyframeKeyBuilder {
825 pub fn style_sheet_id(
826 mut self,
827 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
828 ) -> Self {
829 self.style_sheet_id = Some(style_sheet_id.into());
830 self
831 }
832 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
833 self.range = Some(range.into());
834 self
835 }
836 pub fn key_text(mut self, key_text: impl Into<String>) -> Self {
837 self.key_text = Some(key_text.into());
838 self
839 }
840 pub fn build(self) -> Result<SetKeyframeKey, String> {
841 Ok(SetKeyframeKey {
842 method: SetKeyframeKeyMethod::SetKeyframeKey,
843 params: SetKeyframeKeyParams {
844 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
845 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
846 })?,
847 range: self
848 .range
849 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
850 key_text: self.key_text.ok_or_else(|| {
851 format!("Field `{}` is mandatory.", std::stringify!(key_text))
852 })?,
853 },
854 })
855 }
856}
857impl SetMediaText {
858 pub fn builder() -> SetMediaTextBuilder {
859 <SetMediaTextBuilder as Default>::default()
860 }
861}
862#[derive(Default, Clone)]
863pub struct SetMediaTextBuilder {
864 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
865 range: Option<super::types::SourceRange>,
866 text: Option<String>,
867}
868impl SetMediaTextBuilder {
869 pub fn style_sheet_id(
870 mut self,
871 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
872 ) -> Self {
873 self.style_sheet_id = Some(style_sheet_id.into());
874 self
875 }
876 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
877 self.range = Some(range.into());
878 self
879 }
880 pub fn text(mut self, text: impl Into<String>) -> Self {
881 self.text = Some(text.into());
882 self
883 }
884 pub fn build(self) -> Result<SetMediaText, String> {
885 Ok(SetMediaText {
886 method: SetMediaTextMethod::SetMediaText,
887 params: SetMediaTextParams {
888 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
889 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
890 })?,
891 range: self
892 .range
893 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
894 text: self
895 .text
896 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
897 },
898 })
899 }
900}
901impl SetContainerQueryText {
902 pub fn builder() -> SetContainerQueryTextBuilder {
903 <SetContainerQueryTextBuilder as Default>::default()
904 }
905}
906#[derive(Default, Clone)]
907pub struct SetContainerQueryTextBuilder {
908 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
909 range: Option<super::types::SourceRange>,
910 text: Option<String>,
911}
912impl SetContainerQueryTextBuilder {
913 pub fn style_sheet_id(
914 mut self,
915 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
916 ) -> Self {
917 self.style_sheet_id = Some(style_sheet_id.into());
918 self
919 }
920 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
921 self.range = Some(range.into());
922 self
923 }
924 pub fn text(mut self, text: impl Into<String>) -> Self {
925 self.text = Some(text.into());
926 self
927 }
928 pub fn build(self) -> Result<SetContainerQueryText, String> {
929 Ok(SetContainerQueryText {
930 method: SetContainerQueryTextMethod::SetContainerQueryText,
931 params: SetContainerQueryTextParams {
932 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
933 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
934 })?,
935 range: self
936 .range
937 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
938 text: self
939 .text
940 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
941 },
942 })
943 }
944}
945impl SetSupportsText {
946 pub fn builder() -> SetSupportsTextBuilder {
947 <SetSupportsTextBuilder as Default>::default()
948 }
949}
950#[derive(Default, Clone)]
951pub struct SetSupportsTextBuilder {
952 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
953 range: Option<super::types::SourceRange>,
954 text: Option<String>,
955}
956impl SetSupportsTextBuilder {
957 pub fn style_sheet_id(
958 mut self,
959 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
960 ) -> Self {
961 self.style_sheet_id = Some(style_sheet_id.into());
962 self
963 }
964 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
965 self.range = Some(range.into());
966 self
967 }
968 pub fn text(mut self, text: impl Into<String>) -> Self {
969 self.text = Some(text.into());
970 self
971 }
972 pub fn build(self) -> Result<SetSupportsText, String> {
973 Ok(SetSupportsText {
974 method: SetSupportsTextMethod::SetSupportsText,
975 params: SetSupportsTextParams {
976 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
977 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
978 })?,
979 range: self
980 .range
981 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
982 text: self
983 .text
984 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
985 },
986 })
987 }
988}
989impl SetScopeText {
990 pub fn builder() -> SetScopeTextBuilder {
991 <SetScopeTextBuilder as Default>::default()
992 }
993}
994#[derive(Default, Clone)]
995pub struct SetScopeTextBuilder {
996 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
997 range: Option<super::types::SourceRange>,
998 text: Option<String>,
999}
1000impl SetScopeTextBuilder {
1001 pub fn style_sheet_id(
1002 mut self,
1003 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
1004 ) -> Self {
1005 self.style_sheet_id = Some(style_sheet_id.into());
1006 self
1007 }
1008 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
1009 self.range = Some(range.into());
1010 self
1011 }
1012 pub fn text(mut self, text: impl Into<String>) -> Self {
1013 self.text = Some(text.into());
1014 self
1015 }
1016 pub fn build(self) -> Result<SetScopeText, String> {
1017 Ok(SetScopeText {
1018 method: SetScopeTextMethod::SetScopeText,
1019 params: SetScopeTextParams {
1020 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
1021 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
1022 })?,
1023 range: self
1024 .range
1025 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
1026 text: self
1027 .text
1028 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
1029 },
1030 })
1031 }
1032}
1033impl SetRuleSelector {
1034 pub fn builder() -> SetRuleSelectorBuilder {
1035 <SetRuleSelectorBuilder as Default>::default()
1036 }
1037}
1038#[derive(Default, Clone)]
1039pub struct SetRuleSelectorBuilder {
1040 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
1041 range: Option<super::types::SourceRange>,
1042 selector: Option<String>,
1043}
1044impl SetRuleSelectorBuilder {
1045 pub fn style_sheet_id(
1046 mut self,
1047 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
1048 ) -> Self {
1049 self.style_sheet_id = Some(style_sheet_id.into());
1050 self
1051 }
1052 pub fn range(mut self, range: impl Into<super::types::SourceRange>) -> Self {
1053 self.range = Some(range.into());
1054 self
1055 }
1056 pub fn selector(mut self, selector: impl Into<String>) -> Self {
1057 self.selector = Some(selector.into());
1058 self
1059 }
1060 pub fn build(self) -> Result<SetRuleSelector, String> {
1061 Ok(SetRuleSelector {
1062 method: SetRuleSelectorMethod::SetRuleSelector,
1063 params: SetRuleSelectorParams {
1064 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
1065 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
1066 })?,
1067 range: self
1068 .range
1069 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(range)))?,
1070 selector: self.selector.ok_or_else(|| {
1071 format!("Field `{}` is mandatory.", std::stringify!(selector))
1072 })?,
1073 },
1074 })
1075 }
1076}
1077impl SetStyleSheetText {
1078 pub fn builder() -> SetStyleSheetTextBuilder {
1079 <SetStyleSheetTextBuilder as Default>::default()
1080 }
1081}
1082#[derive(Default, Clone)]
1083pub struct SetStyleSheetTextBuilder {
1084 style_sheet_id: Option<crate::browser_protocol::dom::types::StyleSheetId>,
1085 text: Option<String>,
1086}
1087impl SetStyleSheetTextBuilder {
1088 pub fn style_sheet_id(
1089 mut self,
1090 style_sheet_id: impl Into<crate::browser_protocol::dom::types::StyleSheetId>,
1091 ) -> Self {
1092 self.style_sheet_id = Some(style_sheet_id.into());
1093 self
1094 }
1095 pub fn text(mut self, text: impl Into<String>) -> Self {
1096 self.text = Some(text.into());
1097 self
1098 }
1099 pub fn build(self) -> Result<SetStyleSheetText, String> {
1100 Ok(SetStyleSheetText {
1101 method: SetStyleSheetTextMethod::SetStyleSheetText,
1102 params: SetStyleSheetTextParams {
1103 style_sheet_id: self.style_sheet_id.ok_or_else(|| {
1104 format!("Field `{}` is mandatory.", std::stringify!(style_sheet_id))
1105 })?,
1106 text: self
1107 .text
1108 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
1109 },
1110 })
1111 }
1112}
1113impl SetStyleTexts {
1114 pub fn builder() -> SetStyleTextsBuilder {
1115 <SetStyleTextsBuilder as Default>::default()
1116 }
1117}
1118#[derive(Default, Clone)]
1119pub struct SetStyleTextsBuilder {
1120 edits: Option<Vec<super::types::StyleDeclarationEdit>>,
1121 node_for_property_syntax_validation: Option<crate::browser_protocol::dom::types::NodeId>,
1122}
1123impl SetStyleTextsBuilder {
1124 pub fn edit(mut self, edit: impl Into<super::types::StyleDeclarationEdit>) -> Self {
1125 let v = self.edits.get_or_insert(Vec::new());
1126 v.push(edit.into());
1127 self
1128 }
1129 pub fn edits<I, S>(mut self, edits: I) -> Self
1130 where
1131 I: IntoIterator<Item = S>,
1132 S: Into<super::types::StyleDeclarationEdit>,
1133 {
1134 let v = self.edits.get_or_insert(Vec::new());
1135 for val in edits {
1136 v.push(val.into());
1137 }
1138 self
1139 }
1140 pub fn node_for_property_syntax_validation(
1141 mut self,
1142 node_for_property_syntax_validation: impl Into<crate::browser_protocol::dom::types::NodeId>,
1143 ) -> Self {
1144 self.node_for_property_syntax_validation = Some(node_for_property_syntax_validation.into());
1145 self
1146 }
1147 pub fn build(self) -> Result<SetStyleTexts, String> {
1148 Ok(SetStyleTexts {
1149 method: SetStyleTextsMethod::SetStyleTexts,
1150 params: SetStyleTextsParams {
1151 edits: self
1152 .edits
1153 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(edits)))?,
1154 node_for_property_syntax_validation: self.node_for_property_syntax_validation,
1155 },
1156 })
1157 }
1158}
1159#[derive(Debug, Clone, Default)]
1160pub struct StartRuleUsageTrackingBuilder;
1161impl StartRuleUsageTrackingBuilder {
1162 pub fn new() -> Self {
1163 Self
1164 }
1165 pub fn build(self) -> StartRuleUsageTracking {
1166 StartRuleUsageTracking {
1167 method: StartRuleUsageTrackingMethod::StartRuleUsageTracking,
1168 params: StartRuleUsageTrackingParams {},
1169 }
1170 }
1171}
1172impl StartRuleUsageTracking {
1173 pub fn builder() -> StartRuleUsageTrackingBuilder {
1174 StartRuleUsageTrackingBuilder
1175 }
1176}
1177#[derive(Debug, Clone, Default)]
1178pub struct StopRuleUsageTrackingBuilder;
1179impl StopRuleUsageTrackingBuilder {
1180 pub fn new() -> Self {
1181 Self
1182 }
1183 pub fn build(self) -> StopRuleUsageTracking {
1184 StopRuleUsageTracking {
1185 method: StopRuleUsageTrackingMethod::StopRuleUsageTracking,
1186 params: StopRuleUsageTrackingParams {},
1187 }
1188 }
1189}
1190impl StopRuleUsageTracking {
1191 pub fn builder() -> StopRuleUsageTrackingBuilder {
1192 StopRuleUsageTrackingBuilder
1193 }
1194}
1195#[derive(Debug, Clone, Default)]
1196pub struct TakeCoverageDeltaBuilder;
1197impl TakeCoverageDeltaBuilder {
1198 pub fn new() -> Self {
1199 Self
1200 }
1201 pub fn build(self) -> TakeCoverageDelta {
1202 TakeCoverageDelta {
1203 method: TakeCoverageDeltaMethod::TakeCoverageDelta,
1204 params: TakeCoverageDeltaParams {},
1205 }
1206 }
1207}
1208impl TakeCoverageDelta {
1209 pub fn builder() -> TakeCoverageDeltaBuilder {
1210 TakeCoverageDeltaBuilder
1211 }
1212}
1213impl SetLocalFontsEnabled {
1214 pub fn builder() -> SetLocalFontsEnabledBuilder {
1215 <SetLocalFontsEnabledBuilder as Default>::default()
1216 }
1217}
1218#[derive(Default, Clone)]
1219pub struct SetLocalFontsEnabledBuilder {
1220 enabled: Option<bool>,
1221}
1222impl SetLocalFontsEnabledBuilder {
1223 pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
1224 self.enabled = Some(enabled.into());
1225 self
1226 }
1227 pub fn build(self) -> Result<SetLocalFontsEnabled, String> {
1228 Ok(SetLocalFontsEnabled {
1229 method: SetLocalFontsEnabledMethod::SetLocalFontsEnabled,
1230 params: SetLocalFontsEnabledParams {
1231 enabled: self
1232 .enabled
1233 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
1234 },
1235 })
1236 }
1237}