1use super::commands::*;
2impl ContinueToLocation {
3 pub fn builder() -> ContinueToLocationBuilder {
4 <ContinueToLocationBuilder as Default>::default()
5 }
6}
7#[derive(Default, Clone)]
8pub struct ContinueToLocationBuilder {
9 location: Option<super::types::Location>,
10 target_call_frames: Option<ContinueToLocationTargetCallFrames>,
11}
12impl ContinueToLocationBuilder {
13 pub fn location(mut self, location: impl Into<super::types::Location>) -> Self {
14 self.location = Some(location.into());
15 self
16 }
17 pub fn target_call_frames(
18 mut self,
19 target_call_frames: impl Into<ContinueToLocationTargetCallFrames>,
20 ) -> Self {
21 self.target_call_frames = Some(target_call_frames.into());
22 self
23 }
24 pub fn build(self) -> Result<ContinueToLocation, String> {
25 Ok(ContinueToLocation {
26 method: ContinueToLocationMethod::ContinueToLocation,
27 params: ContinueToLocationParams {
28 location: self.location.ok_or_else(|| {
29 format!("Field `{}` is mandatory.", std::stringify!(location))
30 })?,
31 target_call_frames: self.target_call_frames,
32 },
33 })
34 }
35}
36#[derive(Debug, Clone, Default)]
37pub struct DisableBuilder;
38impl DisableBuilder {
39 pub fn new() -> Self {
40 Self
41 }
42 pub fn build(self) -> Disable {
43 Disable {
44 method: DisableMethod::Disable,
45 params: DisableParams {},
46 }
47 }
48}
49impl Disable {
50 pub fn builder() -> DisableBuilder {
51 DisableBuilder
52 }
53}
54impl Enable {
55 pub fn builder() -> EnableBuilder {
56 <EnableBuilder as Default>::default()
57 }
58}
59#[derive(Default, Clone)]
60pub struct EnableBuilder {
61 max_scripts_cache_size: Option<f64>,
62}
63impl EnableBuilder {
64 pub fn max_scripts_cache_size(mut self, max_scripts_cache_size: impl Into<f64>) -> Self {
65 self.max_scripts_cache_size = Some(max_scripts_cache_size.into());
66 self
67 }
68 pub fn build(self) -> Enable {
69 Enable {
70 method: EnableMethod::Enable,
71 params: EnableParams {
72 max_scripts_cache_size: self.max_scripts_cache_size,
73 },
74 }
75 }
76}
77impl EvaluateOnCallFrame {
78 pub fn builder() -> EvaluateOnCallFrameBuilder {
79 <EvaluateOnCallFrameBuilder as Default>::default()
80 }
81}
82#[derive(Default, Clone)]
83pub struct EvaluateOnCallFrameBuilder {
84 call_frame_id: Option<super::types::CallFrameId>,
85 expression: Option<String>,
86 object_group: Option<String>,
87 include_command_line_api: Option<bool>,
88 silent: Option<bool>,
89 return_by_value: Option<bool>,
90 generate_preview: Option<bool>,
91 throw_on_side_effect: Option<bool>,
92 timeout: Option<crate::js_protocol::runtime::types::TimeDelta>,
93}
94impl EvaluateOnCallFrameBuilder {
95 pub fn call_frame_id(mut self, call_frame_id: impl Into<super::types::CallFrameId>) -> Self {
96 self.call_frame_id = Some(call_frame_id.into());
97 self
98 }
99 pub fn expression(mut self, expression: impl Into<String>) -> Self {
100 self.expression = Some(expression.into());
101 self
102 }
103 pub fn object_group(mut self, object_group: impl Into<String>) -> Self {
104 self.object_group = Some(object_group.into());
105 self
106 }
107 pub fn include_command_line_api(mut self, include_command_line_api: impl Into<bool>) -> Self {
108 self.include_command_line_api = Some(include_command_line_api.into());
109 self
110 }
111 pub fn silent(mut self, silent: impl Into<bool>) -> Self {
112 self.silent = Some(silent.into());
113 self
114 }
115 pub fn return_by_value(mut self, return_by_value: impl Into<bool>) -> Self {
116 self.return_by_value = Some(return_by_value.into());
117 self
118 }
119 pub fn generate_preview(mut self, generate_preview: impl Into<bool>) -> Self {
120 self.generate_preview = Some(generate_preview.into());
121 self
122 }
123 pub fn throw_on_side_effect(mut self, throw_on_side_effect: impl Into<bool>) -> Self {
124 self.throw_on_side_effect = Some(throw_on_side_effect.into());
125 self
126 }
127 pub fn timeout(
128 mut self,
129 timeout: impl Into<crate::js_protocol::runtime::types::TimeDelta>,
130 ) -> Self {
131 self.timeout = Some(timeout.into());
132 self
133 }
134 pub fn build(self) -> Result<EvaluateOnCallFrame, String> {
135 Ok(EvaluateOnCallFrame {
136 method: EvaluateOnCallFrameMethod::EvaluateOnCallFrame,
137 params: EvaluateOnCallFrameParams {
138 call_frame_id: self.call_frame_id.ok_or_else(|| {
139 format!("Field `{}` is mandatory.", std::stringify!(call_frame_id))
140 })?,
141 expression: self.expression.ok_or_else(|| {
142 format!("Field `{}` is mandatory.", std::stringify!(expression))
143 })?,
144 object_group: self.object_group,
145 include_command_line_api: self.include_command_line_api,
146 silent: self.silent,
147 return_by_value: self.return_by_value,
148 generate_preview: self.generate_preview,
149 throw_on_side_effect: self.throw_on_side_effect,
150 timeout: self.timeout,
151 },
152 })
153 }
154}
155impl GetPossibleBreakpoints {
156 pub fn builder() -> GetPossibleBreakpointsBuilder {
157 <GetPossibleBreakpointsBuilder as Default>::default()
158 }
159}
160#[derive(Default, Clone)]
161pub struct GetPossibleBreakpointsBuilder {
162 start: Option<super::types::Location>,
163 end: Option<super::types::Location>,
164 restrict_to_function: Option<bool>,
165}
166impl GetPossibleBreakpointsBuilder {
167 pub fn start(mut self, start: impl Into<super::types::Location>) -> Self {
168 self.start = Some(start.into());
169 self
170 }
171 pub fn end(mut self, end: impl Into<super::types::Location>) -> Self {
172 self.end = Some(end.into());
173 self
174 }
175 pub fn restrict_to_function(mut self, restrict_to_function: impl Into<bool>) -> Self {
176 self.restrict_to_function = Some(restrict_to_function.into());
177 self
178 }
179 pub fn build(self) -> Result<GetPossibleBreakpoints, String> {
180 Ok(GetPossibleBreakpoints {
181 method: GetPossibleBreakpointsMethod::GetPossibleBreakpoints,
182 params: GetPossibleBreakpointsParams {
183 start: self
184 .start
185 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(start)))?,
186 end: self.end,
187 restrict_to_function: self.restrict_to_function,
188 },
189 })
190 }
191}
192impl GetScriptSource {
193 pub fn builder() -> GetScriptSourceBuilder {
194 <GetScriptSourceBuilder as Default>::default()
195 }
196}
197#[derive(Default, Clone)]
198pub struct GetScriptSourceBuilder {
199 script_id: Option<crate::js_protocol::runtime::types::ScriptId>,
200}
201impl GetScriptSourceBuilder {
202 pub fn script_id(
203 mut self,
204 script_id: impl Into<crate::js_protocol::runtime::types::ScriptId>,
205 ) -> Self {
206 self.script_id = Some(script_id.into());
207 self
208 }
209 pub fn build(self) -> Result<GetScriptSource, String> {
210 Ok(GetScriptSource {
211 method: GetScriptSourceMethod::GetScriptSource,
212 params: GetScriptSourceParams {
213 script_id: self.script_id.ok_or_else(|| {
214 format!("Field `{}` is mandatory.", std::stringify!(script_id))
215 })?,
216 },
217 })
218 }
219}
220impl DisassembleWasmModule {
221 pub fn builder() -> DisassembleWasmModuleBuilder {
222 <DisassembleWasmModuleBuilder as Default>::default()
223 }
224}
225#[derive(Default, Clone)]
226pub struct DisassembleWasmModuleBuilder {
227 script_id: Option<crate::js_protocol::runtime::types::ScriptId>,
228}
229impl DisassembleWasmModuleBuilder {
230 pub fn script_id(
231 mut self,
232 script_id: impl Into<crate::js_protocol::runtime::types::ScriptId>,
233 ) -> Self {
234 self.script_id = Some(script_id.into());
235 self
236 }
237 pub fn build(self) -> Result<DisassembleWasmModule, String> {
238 Ok(DisassembleWasmModule {
239 method: DisassembleWasmModuleMethod::DisassembleWasmModule,
240 params: DisassembleWasmModuleParams {
241 script_id: self.script_id.ok_or_else(|| {
242 format!("Field `{}` is mandatory.", std::stringify!(script_id))
243 })?,
244 },
245 })
246 }
247}
248impl NextWasmDisassemblyChunk {
249 pub fn builder() -> NextWasmDisassemblyChunkBuilder {
250 <NextWasmDisassemblyChunkBuilder as Default>::default()
251 }
252}
253#[derive(Default, Clone)]
254pub struct NextWasmDisassemblyChunkBuilder {
255 stream_id: Option<String>,
256}
257impl NextWasmDisassemblyChunkBuilder {
258 pub fn stream_id(mut self, stream_id: impl Into<String>) -> Self {
259 self.stream_id = Some(stream_id.into());
260 self
261 }
262 pub fn build(self) -> Result<NextWasmDisassemblyChunk, String> {
263 Ok(NextWasmDisassemblyChunk {
264 method: NextWasmDisassemblyChunkMethod::NextWasmDisassemblyChunk,
265 params: NextWasmDisassemblyChunkParams {
266 stream_id: self.stream_id.ok_or_else(|| {
267 format!("Field `{}` is mandatory.", std::stringify!(stream_id))
268 })?,
269 },
270 })
271 }
272}
273impl GetStackTrace {
274 pub fn builder() -> GetStackTraceBuilder {
275 <GetStackTraceBuilder as Default>::default()
276 }
277}
278#[derive(Default, Clone)]
279pub struct GetStackTraceBuilder {
280 stack_trace_id: Option<crate::js_protocol::runtime::types::StackTraceId>,
281}
282impl GetStackTraceBuilder {
283 pub fn stack_trace_id(
284 mut self,
285 stack_trace_id: impl Into<crate::js_protocol::runtime::types::StackTraceId>,
286 ) -> Self {
287 self.stack_trace_id = Some(stack_trace_id.into());
288 self
289 }
290 pub fn build(self) -> Result<GetStackTrace, String> {
291 Ok(GetStackTrace {
292 method: GetStackTraceMethod::GetStackTrace,
293 params: GetStackTraceParams {
294 stack_trace_id: self.stack_trace_id.ok_or_else(|| {
295 format!("Field `{}` is mandatory.", std::stringify!(stack_trace_id))
296 })?,
297 },
298 })
299 }
300}
301#[derive(Debug, Clone, Default)]
302pub struct PauseBuilder;
303impl PauseBuilder {
304 pub fn new() -> Self {
305 Self
306 }
307 pub fn build(self) -> Pause {
308 Pause {
309 method: PauseMethod::Pause,
310 params: PauseParams {},
311 }
312 }
313}
314impl Pause {
315 pub fn builder() -> PauseBuilder {
316 PauseBuilder
317 }
318}
319impl RemoveBreakpoint {
320 pub fn builder() -> RemoveBreakpointBuilder {
321 <RemoveBreakpointBuilder as Default>::default()
322 }
323}
324#[derive(Default, Clone)]
325pub struct RemoveBreakpointBuilder {
326 breakpoint_id: Option<super::types::BreakpointId>,
327}
328impl RemoveBreakpointBuilder {
329 pub fn breakpoint_id(mut self, breakpoint_id: impl Into<super::types::BreakpointId>) -> Self {
330 self.breakpoint_id = Some(breakpoint_id.into());
331 self
332 }
333 pub fn build(self) -> Result<RemoveBreakpoint, String> {
334 Ok(RemoveBreakpoint {
335 method: RemoveBreakpointMethod::RemoveBreakpoint,
336 params: RemoveBreakpointParams {
337 breakpoint_id: self.breakpoint_id.ok_or_else(|| {
338 format!("Field `{}` is mandatory.", std::stringify!(breakpoint_id))
339 })?,
340 },
341 })
342 }
343}
344impl RestartFrame {
345 pub fn builder() -> RestartFrameBuilder {
346 <RestartFrameBuilder as Default>::default()
347 }
348}
349#[derive(Default, Clone)]
350pub struct RestartFrameBuilder {
351 call_frame_id: Option<super::types::CallFrameId>,
352 mode: Option<RestartFrameMode>,
353}
354impl RestartFrameBuilder {
355 pub fn call_frame_id(mut self, call_frame_id: impl Into<super::types::CallFrameId>) -> Self {
356 self.call_frame_id = Some(call_frame_id.into());
357 self
358 }
359 pub fn mode(mut self, mode: impl Into<RestartFrameMode>) -> Self {
360 self.mode = Some(mode.into());
361 self
362 }
363 pub fn build(self) -> Result<RestartFrame, String> {
364 Ok(RestartFrame {
365 method: RestartFrameMethod::RestartFrame,
366 params: RestartFrameParams {
367 call_frame_id: self.call_frame_id.ok_or_else(|| {
368 format!("Field `{}` is mandatory.", std::stringify!(call_frame_id))
369 })?,
370 mode: self.mode,
371 },
372 })
373 }
374}
375impl Resume {
376 pub fn builder() -> ResumeBuilder {
377 <ResumeBuilder as Default>::default()
378 }
379}
380#[derive(Default, Clone)]
381pub struct ResumeBuilder {
382 terminate_on_resume: Option<bool>,
383}
384impl ResumeBuilder {
385 pub fn terminate_on_resume(mut self, terminate_on_resume: impl Into<bool>) -> Self {
386 self.terminate_on_resume = Some(terminate_on_resume.into());
387 self
388 }
389 pub fn build(self) -> Resume {
390 Resume {
391 method: ResumeMethod::Resume,
392 params: ResumeParams {
393 terminate_on_resume: self.terminate_on_resume,
394 },
395 }
396 }
397}
398impl SearchInContent {
399 pub fn builder() -> SearchInContentBuilder {
400 <SearchInContentBuilder as Default>::default()
401 }
402}
403#[derive(Default, Clone)]
404pub struct SearchInContentBuilder {
405 script_id: Option<crate::js_protocol::runtime::types::ScriptId>,
406 query: Option<String>,
407 case_sensitive: Option<bool>,
408 is_regex: Option<bool>,
409}
410impl SearchInContentBuilder {
411 pub fn script_id(
412 mut self,
413 script_id: impl Into<crate::js_protocol::runtime::types::ScriptId>,
414 ) -> Self {
415 self.script_id = Some(script_id.into());
416 self
417 }
418 pub fn query(mut self, query: impl Into<String>) -> Self {
419 self.query = Some(query.into());
420 self
421 }
422 pub fn case_sensitive(mut self, case_sensitive: impl Into<bool>) -> Self {
423 self.case_sensitive = Some(case_sensitive.into());
424 self
425 }
426 pub fn is_regex(mut self, is_regex: impl Into<bool>) -> Self {
427 self.is_regex = Some(is_regex.into());
428 self
429 }
430 pub fn build(self) -> Result<SearchInContent, String> {
431 Ok(SearchInContent {
432 method: SearchInContentMethod::SearchInContent,
433 params: SearchInContentParams {
434 script_id: self.script_id.ok_or_else(|| {
435 format!("Field `{}` is mandatory.", std::stringify!(script_id))
436 })?,
437 query: self
438 .query
439 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(query)))?,
440 case_sensitive: self.case_sensitive,
441 is_regex: self.is_regex,
442 },
443 })
444 }
445}
446impl SetAsyncCallStackDepth {
447 pub fn builder() -> SetAsyncCallStackDepthBuilder {
448 <SetAsyncCallStackDepthBuilder as Default>::default()
449 }
450}
451#[derive(Default, Clone)]
452pub struct SetAsyncCallStackDepthBuilder {
453 max_depth: Option<i64>,
454}
455impl SetAsyncCallStackDepthBuilder {
456 pub fn max_depth(mut self, max_depth: impl Into<i64>) -> Self {
457 self.max_depth = Some(max_depth.into());
458 self
459 }
460 pub fn build(self) -> Result<SetAsyncCallStackDepth, String> {
461 Ok(SetAsyncCallStackDepth {
462 method: SetAsyncCallStackDepthMethod::SetAsyncCallStackDepth,
463 params: SetAsyncCallStackDepthParams {
464 max_depth: self.max_depth.ok_or_else(|| {
465 format!("Field `{}` is mandatory.", std::stringify!(max_depth))
466 })?,
467 },
468 })
469 }
470}
471impl SetBlackboxExecutionContexts {
472 pub fn builder() -> SetBlackboxExecutionContextsBuilder {
473 <SetBlackboxExecutionContextsBuilder as Default>::default()
474 }
475}
476#[derive(Default, Clone)]
477pub struct SetBlackboxExecutionContextsBuilder {
478 unique_ids: Option<Vec<String>>,
479}
480impl SetBlackboxExecutionContextsBuilder {
481 pub fn unique_id(mut self, unique_id: impl Into<String>) -> Self {
482 let v = self.unique_ids.get_or_insert(Vec::new());
483 v.push(unique_id.into());
484 self
485 }
486 pub fn unique_ids<I, S>(mut self, unique_ids: I) -> Self
487 where
488 I: IntoIterator<Item = S>,
489 S: Into<String>,
490 {
491 let v = self.unique_ids.get_or_insert(Vec::new());
492 for val in unique_ids {
493 v.push(val.into());
494 }
495 self
496 }
497 pub fn build(self) -> Result<SetBlackboxExecutionContexts, String> {
498 Ok(SetBlackboxExecutionContexts {
499 method: SetBlackboxExecutionContextsMethod::SetBlackboxExecutionContexts,
500 params: SetBlackboxExecutionContextsParams {
501 unique_ids: self.unique_ids.ok_or_else(|| {
502 format!("Field `{}` is mandatory.", std::stringify!(unique_ids))
503 })?,
504 },
505 })
506 }
507}
508impl SetBlackboxPatterns {
509 pub fn builder() -> SetBlackboxPatternsBuilder {
510 <SetBlackboxPatternsBuilder as Default>::default()
511 }
512}
513#[derive(Default, Clone)]
514pub struct SetBlackboxPatternsBuilder {
515 patterns: Option<Vec<String>>,
516 skip_anonymous: Option<bool>,
517}
518impl SetBlackboxPatternsBuilder {
519 pub fn pattern(mut self, pattern: impl Into<String>) -> Self {
520 let v = self.patterns.get_or_insert(Vec::new());
521 v.push(pattern.into());
522 self
523 }
524 pub fn patterns<I, S>(mut self, patterns: I) -> Self
525 where
526 I: IntoIterator<Item = S>,
527 S: Into<String>,
528 {
529 let v = self.patterns.get_or_insert(Vec::new());
530 for val in patterns {
531 v.push(val.into());
532 }
533 self
534 }
535 pub fn skip_anonymous(mut self, skip_anonymous: impl Into<bool>) -> Self {
536 self.skip_anonymous = Some(skip_anonymous.into());
537 self
538 }
539 pub fn build(self) -> Result<SetBlackboxPatterns, String> {
540 Ok(SetBlackboxPatterns {
541 method: SetBlackboxPatternsMethod::SetBlackboxPatterns,
542 params: SetBlackboxPatternsParams {
543 patterns: self.patterns.ok_or_else(|| {
544 format!("Field `{}` is mandatory.", std::stringify!(patterns))
545 })?,
546 skip_anonymous: self.skip_anonymous,
547 },
548 })
549 }
550}
551impl SetBlackboxedRanges {
552 pub fn builder() -> SetBlackboxedRangesBuilder {
553 <SetBlackboxedRangesBuilder as Default>::default()
554 }
555}
556#[derive(Default, Clone)]
557pub struct SetBlackboxedRangesBuilder {
558 script_id: Option<crate::js_protocol::runtime::types::ScriptId>,
559 positions: Option<Vec<super::types::ScriptPosition>>,
560}
561impl SetBlackboxedRangesBuilder {
562 pub fn script_id(
563 mut self,
564 script_id: impl Into<crate::js_protocol::runtime::types::ScriptId>,
565 ) -> Self {
566 self.script_id = Some(script_id.into());
567 self
568 }
569 pub fn position(mut self, position: impl Into<super::types::ScriptPosition>) -> Self {
570 let v = self.positions.get_or_insert(Vec::new());
571 v.push(position.into());
572 self
573 }
574 pub fn positions<I, S>(mut self, positions: I) -> Self
575 where
576 I: IntoIterator<Item = S>,
577 S: Into<super::types::ScriptPosition>,
578 {
579 let v = self.positions.get_or_insert(Vec::new());
580 for val in positions {
581 v.push(val.into());
582 }
583 self
584 }
585 pub fn build(self) -> Result<SetBlackboxedRanges, String> {
586 Ok(SetBlackboxedRanges {
587 method: SetBlackboxedRangesMethod::SetBlackboxedRanges,
588 params: SetBlackboxedRangesParams {
589 script_id: self.script_id.ok_or_else(|| {
590 format!("Field `{}` is mandatory.", std::stringify!(script_id))
591 })?,
592 positions: self.positions.ok_or_else(|| {
593 format!("Field `{}` is mandatory.", std::stringify!(positions))
594 })?,
595 },
596 })
597 }
598}
599impl SetBreakpoint {
600 pub fn builder() -> SetBreakpointBuilder {
601 <SetBreakpointBuilder as Default>::default()
602 }
603}
604#[derive(Default, Clone)]
605pub struct SetBreakpointBuilder {
606 location: Option<super::types::Location>,
607 condition: Option<String>,
608}
609impl SetBreakpointBuilder {
610 pub fn location(mut self, location: impl Into<super::types::Location>) -> Self {
611 self.location = Some(location.into());
612 self
613 }
614 pub fn condition(mut self, condition: impl Into<String>) -> Self {
615 self.condition = Some(condition.into());
616 self
617 }
618 pub fn build(self) -> Result<SetBreakpoint, String> {
619 Ok(SetBreakpoint {
620 method: SetBreakpointMethod::SetBreakpoint,
621 params: SetBreakpointParams {
622 location: self.location.ok_or_else(|| {
623 format!("Field `{}` is mandatory.", std::stringify!(location))
624 })?,
625 condition: self.condition,
626 },
627 })
628 }
629}
630impl SetInstrumentationBreakpoint {
631 pub fn builder() -> SetInstrumentationBreakpointBuilder {
632 <SetInstrumentationBreakpointBuilder as Default>::default()
633 }
634}
635#[derive(Default, Clone)]
636pub struct SetInstrumentationBreakpointBuilder {
637 instrumentation: Option<SetInstrumentationBreakpointInstrumentation>,
638}
639impl SetInstrumentationBreakpointBuilder {
640 pub fn instrumentation(
641 mut self,
642 instrumentation: impl Into<SetInstrumentationBreakpointInstrumentation>,
643 ) -> Self {
644 self.instrumentation = Some(instrumentation.into());
645 self
646 }
647 pub fn build(self) -> Result<SetInstrumentationBreakpoint, String> {
648 Ok(SetInstrumentationBreakpoint {
649 method: SetInstrumentationBreakpointMethod::SetInstrumentationBreakpoint,
650 params: SetInstrumentationBreakpointParams {
651 instrumentation: self.instrumentation.ok_or_else(|| {
652 format!("Field `{}` is mandatory.", std::stringify!(instrumentation))
653 })?,
654 },
655 })
656 }
657}
658impl SetBreakpointByUrl {
659 pub fn builder() -> SetBreakpointByUrlBuilder {
660 <SetBreakpointByUrlBuilder as Default>::default()
661 }
662}
663#[derive(Default, Clone)]
664pub struct SetBreakpointByUrlBuilder {
665 line_number: Option<i64>,
666 url: Option<String>,
667 url_regex: Option<String>,
668 script_hash: Option<String>,
669 column_number: Option<i64>,
670 condition: Option<String>,
671}
672impl SetBreakpointByUrlBuilder {
673 pub fn line_number(mut self, line_number: impl Into<i64>) -> Self {
674 self.line_number = Some(line_number.into());
675 self
676 }
677 pub fn url(mut self, url: impl Into<String>) -> Self {
678 self.url = Some(url.into());
679 self
680 }
681 pub fn url_regex(mut self, url_regex: impl Into<String>) -> Self {
682 self.url_regex = Some(url_regex.into());
683 self
684 }
685 pub fn script_hash(mut self, script_hash: impl Into<String>) -> Self {
686 self.script_hash = Some(script_hash.into());
687 self
688 }
689 pub fn column_number(mut self, column_number: impl Into<i64>) -> Self {
690 self.column_number = Some(column_number.into());
691 self
692 }
693 pub fn condition(mut self, condition: impl Into<String>) -> Self {
694 self.condition = Some(condition.into());
695 self
696 }
697 pub fn build(self) -> Result<SetBreakpointByUrl, String> {
698 Ok(SetBreakpointByUrl {
699 method: SetBreakpointByUrlMethod::SetBreakpointByUrl,
700 params: SetBreakpointByUrlParams {
701 line_number: self.line_number.ok_or_else(|| {
702 format!("Field `{}` is mandatory.", std::stringify!(line_number))
703 })?,
704 url: self.url,
705 url_regex: self.url_regex,
706 script_hash: self.script_hash,
707 column_number: self.column_number,
708 condition: self.condition,
709 },
710 })
711 }
712}
713impl SetBreakpointOnFunctionCall {
714 pub fn builder() -> SetBreakpointOnFunctionCallBuilder {
715 <SetBreakpointOnFunctionCallBuilder as Default>::default()
716 }
717}
718#[derive(Default, Clone)]
719pub struct SetBreakpointOnFunctionCallBuilder {
720 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
721 condition: Option<String>,
722}
723impl SetBreakpointOnFunctionCallBuilder {
724 pub fn object_id(
725 mut self,
726 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
727 ) -> Self {
728 self.object_id = Some(object_id.into());
729 self
730 }
731 pub fn condition(mut self, condition: impl Into<String>) -> Self {
732 self.condition = Some(condition.into());
733 self
734 }
735 pub fn build(self) -> Result<SetBreakpointOnFunctionCall, String> {
736 Ok(SetBreakpointOnFunctionCall {
737 method: SetBreakpointOnFunctionCallMethod::SetBreakpointOnFunctionCall,
738 params: SetBreakpointOnFunctionCallParams {
739 object_id: self.object_id.ok_or_else(|| {
740 format!("Field `{}` is mandatory.", std::stringify!(object_id))
741 })?,
742 condition: self.condition,
743 },
744 })
745 }
746}
747impl SetBreakpointsActive {
748 pub fn builder() -> SetBreakpointsActiveBuilder {
749 <SetBreakpointsActiveBuilder as Default>::default()
750 }
751}
752#[derive(Default, Clone)]
753pub struct SetBreakpointsActiveBuilder {
754 active: Option<bool>,
755}
756impl SetBreakpointsActiveBuilder {
757 pub fn active(mut self, active: impl Into<bool>) -> Self {
758 self.active = Some(active.into());
759 self
760 }
761 pub fn build(self) -> Result<SetBreakpointsActive, String> {
762 Ok(SetBreakpointsActive {
763 method: SetBreakpointsActiveMethod::SetBreakpointsActive,
764 params: SetBreakpointsActiveParams {
765 active: self
766 .active
767 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(active)))?,
768 },
769 })
770 }
771}
772impl SetPauseOnExceptions {
773 pub fn builder() -> SetPauseOnExceptionsBuilder {
774 <SetPauseOnExceptionsBuilder as Default>::default()
775 }
776}
777#[derive(Default, Clone)]
778pub struct SetPauseOnExceptionsBuilder {
779 state: Option<SetPauseOnExceptionsState>,
780}
781impl SetPauseOnExceptionsBuilder {
782 pub fn state(mut self, state: impl Into<SetPauseOnExceptionsState>) -> Self {
783 self.state = Some(state.into());
784 self
785 }
786 pub fn build(self) -> Result<SetPauseOnExceptions, String> {
787 Ok(SetPauseOnExceptions {
788 method: SetPauseOnExceptionsMethod::SetPauseOnExceptions,
789 params: SetPauseOnExceptionsParams {
790 state: self
791 .state
792 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(state)))?,
793 },
794 })
795 }
796}
797impl SetReturnValue {
798 pub fn builder() -> SetReturnValueBuilder {
799 <SetReturnValueBuilder as Default>::default()
800 }
801}
802#[derive(Default, Clone)]
803pub struct SetReturnValueBuilder {
804 new_value: Option<crate::js_protocol::runtime::types::CallArgument>,
805}
806impl SetReturnValueBuilder {
807 pub fn new_value(
808 mut self,
809 new_value: impl Into<crate::js_protocol::runtime::types::CallArgument>,
810 ) -> Self {
811 self.new_value = Some(new_value.into());
812 self
813 }
814 pub fn build(self) -> Result<SetReturnValue, String> {
815 Ok(SetReturnValue {
816 method: SetReturnValueMethod::SetReturnValue,
817 params: SetReturnValueParams {
818 new_value: self.new_value.ok_or_else(|| {
819 format!("Field `{}` is mandatory.", std::stringify!(new_value))
820 })?,
821 },
822 })
823 }
824}
825impl SetScriptSource {
826 pub fn builder() -> SetScriptSourceBuilder {
827 <SetScriptSourceBuilder as Default>::default()
828 }
829}
830#[derive(Default, Clone)]
831pub struct SetScriptSourceBuilder {
832 script_id: Option<crate::js_protocol::runtime::types::ScriptId>,
833 script_source: Option<String>,
834 dry_run: Option<bool>,
835 allow_top_frame_editing: Option<bool>,
836}
837impl SetScriptSourceBuilder {
838 pub fn script_id(
839 mut self,
840 script_id: impl Into<crate::js_protocol::runtime::types::ScriptId>,
841 ) -> Self {
842 self.script_id = Some(script_id.into());
843 self
844 }
845 pub fn script_source(mut self, script_source: impl Into<String>) -> Self {
846 self.script_source = Some(script_source.into());
847 self
848 }
849 pub fn dry_run(mut self, dry_run: impl Into<bool>) -> Self {
850 self.dry_run = Some(dry_run.into());
851 self
852 }
853 pub fn allow_top_frame_editing(mut self, allow_top_frame_editing: impl Into<bool>) -> Self {
854 self.allow_top_frame_editing = Some(allow_top_frame_editing.into());
855 self
856 }
857 pub fn build(self) -> Result<SetScriptSource, String> {
858 Ok(SetScriptSource {
859 method: SetScriptSourceMethod::SetScriptSource,
860 params: SetScriptSourceParams {
861 script_id: self.script_id.ok_or_else(|| {
862 format!("Field `{}` is mandatory.", std::stringify!(script_id))
863 })?,
864 script_source: self.script_source.ok_or_else(|| {
865 format!("Field `{}` is mandatory.", std::stringify!(script_source))
866 })?,
867 dry_run: self.dry_run,
868 allow_top_frame_editing: self.allow_top_frame_editing,
869 },
870 })
871 }
872}
873impl SetSkipAllPauses {
874 pub fn builder() -> SetSkipAllPausesBuilder {
875 <SetSkipAllPausesBuilder as Default>::default()
876 }
877}
878#[derive(Default, Clone)]
879pub struct SetSkipAllPausesBuilder {
880 skip: Option<bool>,
881}
882impl SetSkipAllPausesBuilder {
883 pub fn skip(mut self, skip: impl Into<bool>) -> Self {
884 self.skip = Some(skip.into());
885 self
886 }
887 pub fn build(self) -> Result<SetSkipAllPauses, String> {
888 Ok(SetSkipAllPauses {
889 method: SetSkipAllPausesMethod::SetSkipAllPauses,
890 params: SetSkipAllPausesParams {
891 skip: self
892 .skip
893 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(skip)))?,
894 },
895 })
896 }
897}
898impl SetVariableValue {
899 pub fn builder() -> SetVariableValueBuilder {
900 <SetVariableValueBuilder as Default>::default()
901 }
902}
903#[derive(Default, Clone)]
904pub struct SetVariableValueBuilder {
905 scope_number: Option<i64>,
906 variable_name: Option<String>,
907 new_value: Option<crate::js_protocol::runtime::types::CallArgument>,
908 call_frame_id: Option<super::types::CallFrameId>,
909}
910impl SetVariableValueBuilder {
911 pub fn scope_number(mut self, scope_number: impl Into<i64>) -> Self {
912 self.scope_number = Some(scope_number.into());
913 self
914 }
915 pub fn variable_name(mut self, variable_name: impl Into<String>) -> Self {
916 self.variable_name = Some(variable_name.into());
917 self
918 }
919 pub fn new_value(
920 mut self,
921 new_value: impl Into<crate::js_protocol::runtime::types::CallArgument>,
922 ) -> Self {
923 self.new_value = Some(new_value.into());
924 self
925 }
926 pub fn call_frame_id(mut self, call_frame_id: impl Into<super::types::CallFrameId>) -> Self {
927 self.call_frame_id = Some(call_frame_id.into());
928 self
929 }
930 pub fn build(self) -> Result<SetVariableValue, String> {
931 Ok(SetVariableValue {
932 method: SetVariableValueMethod::SetVariableValue,
933 params: SetVariableValueParams {
934 scope_number: self.scope_number.ok_or_else(|| {
935 format!("Field `{}` is mandatory.", std::stringify!(scope_number))
936 })?,
937 variable_name: self.variable_name.ok_or_else(|| {
938 format!("Field `{}` is mandatory.", std::stringify!(variable_name))
939 })?,
940 new_value: self.new_value.ok_or_else(|| {
941 format!("Field `{}` is mandatory.", std::stringify!(new_value))
942 })?,
943 call_frame_id: self.call_frame_id.ok_or_else(|| {
944 format!("Field `{}` is mandatory.", std::stringify!(call_frame_id))
945 })?,
946 },
947 })
948 }
949}
950impl StepInto {
951 pub fn builder() -> StepIntoBuilder {
952 <StepIntoBuilder as Default>::default()
953 }
954}
955#[derive(Default, Clone)]
956pub struct StepIntoBuilder {
957 break_on_async_call: Option<bool>,
958 skip_list: Option<Vec<super::types::LocationRange>>,
959}
960impl StepIntoBuilder {
961 pub fn break_on_async_call(mut self, break_on_async_call: impl Into<bool>) -> Self {
962 self.break_on_async_call = Some(break_on_async_call.into());
963 self
964 }
965 pub fn skip_list(mut self, skip_list: impl Into<super::types::LocationRange>) -> Self {
966 let v = self.skip_list.get_or_insert(Vec::new());
967 v.push(skip_list.into());
968 self
969 }
970 pub fn skip_lists<I, S>(mut self, skip_lists: I) -> Self
971 where
972 I: IntoIterator<Item = S>,
973 S: Into<super::types::LocationRange>,
974 {
975 let v = self.skip_list.get_or_insert(Vec::new());
976 for val in skip_lists {
977 v.push(val.into());
978 }
979 self
980 }
981 pub fn build(self) -> StepInto {
982 StepInto {
983 method: StepIntoMethod::StepInto,
984 params: StepIntoParams {
985 break_on_async_call: self.break_on_async_call,
986 skip_list: self.skip_list,
987 },
988 }
989 }
990}
991#[derive(Debug, Clone, Default)]
992pub struct StepOutBuilder;
993impl StepOutBuilder {
994 pub fn new() -> Self {
995 Self
996 }
997 pub fn build(self) -> StepOut {
998 StepOut {
999 method: StepOutMethod::StepOut,
1000 params: StepOutParams {},
1001 }
1002 }
1003}
1004impl StepOut {
1005 pub fn builder() -> StepOutBuilder {
1006 StepOutBuilder
1007 }
1008}
1009impl StepOver {
1010 pub fn builder() -> StepOverBuilder {
1011 <StepOverBuilder as Default>::default()
1012 }
1013}
1014#[derive(Default, Clone)]
1015pub struct StepOverBuilder {
1016 skip_list: Option<Vec<super::types::LocationRange>>,
1017}
1018impl StepOverBuilder {
1019 pub fn skip_list(mut self, skip_list: impl Into<super::types::LocationRange>) -> Self {
1020 let v = self.skip_list.get_or_insert(Vec::new());
1021 v.push(skip_list.into());
1022 self
1023 }
1024 pub fn skip_lists<I, S>(mut self, skip_lists: I) -> Self
1025 where
1026 I: IntoIterator<Item = S>,
1027 S: Into<super::types::LocationRange>,
1028 {
1029 let v = self.skip_list.get_or_insert(Vec::new());
1030 for val in skip_lists {
1031 v.push(val.into());
1032 }
1033 self
1034 }
1035 pub fn build(self) -> StepOver {
1036 StepOver {
1037 method: StepOverMethod::StepOver,
1038 params: StepOverParams {
1039 skip_list: self.skip_list,
1040 },
1041 }
1042 }
1043}