1#![allow(clippy::all)]
2#![allow(unused, deprecated, dead_code)]
3extern crate std;
4
5use bevy_app::{App, Plugin};
6use bevy_ecs::prelude::*;
7use bevy_mod_scripting_bindings::{
8 ReflectReference,
9 function::{
10 from::{M, R, V},
11 namespace::NamespaceBuilder,
12 },
13};
14use bevy_mod_scripting_derive::script_bindings;
15pub struct BevyTimeScriptingPlugin;
16pub(crate) fn register_fixed_functions(world: &mut World) {
17 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<::bevy_time::Fixed>::new(
18 world,
19 )
20 .register_documented(
21 "clone",
22 |_self: R<::bevy_time::Fixed>| {
23 let output: V<::bevy_time::Fixed> = {
24 {
25 let output: V<::bevy_time::Fixed> =
26 <::bevy_time::Fixed as ::core::clone::Clone>::clone(&_self).into();
27 output
28 }
29 };
30 output
31 },
32 "",
33 &["_self"],
34 );
35 let registry = world.get_resource_or_init::<AppTypeRegistry>();
36 let mut registry = registry.write();
37 registry
38 .register_type_data::<::bevy_time::Fixed, bevy_mod_scripting_bindings::MarkAsGenerated>();
39}
40pub(crate) fn register_real_functions(world: &mut World) {
41 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<::bevy_time::Real>::new(
42 world,
43 )
44 .register_documented(
45 "clone",
46 |_self: R<::bevy_time::Real>| {
47 let output: V<::bevy_time::Real> = {
48 {
49 let output: V<::bevy_time::Real> =
50 <::bevy_time::Real as ::core::clone::Clone>::clone(&_self).into();
51 output
52 }
53 };
54 output
55 },
56 "",
57 &["_self"],
58 );
59 let registry = world.get_resource_or_init::<AppTypeRegistry>();
60 let mut registry = registry.write();
61 registry
62 .register_type_data::<::bevy_time::Real, bevy_mod_scripting_bindings::MarkAsGenerated>();
63}
64pub(crate) fn register_timer_functions(world: &mut World) {
65 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<
66 ::bevy_time::Timer,
67 >::new(world)
68 .register_documented(
69 "almost_finish",
70 |mut _self: M<::bevy_time::Timer>| {
71 let output: () = {
72 {
73 let output: () = ::bevy_time::Timer::almost_finish(&mut _self)
74 .into();
75 output
76 }
77 };
78 output
79 },
80 " Almost finishes the timer leaving 1 ns of remaining time.\n This can be useful when needing an immediate action without having\n to wait for the set duration of the timer in the first tick.\n If the timer is already finished, this does nothing.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.5, TimerMode::Once);\n timer.almost_finish();\n assert!(!timer.is_finished());\n assert_eq!(timer.remaining(), Duration::from_nanos(1));\n ```",
81 &["_self"],
82 )
83 .register_documented(
84 "clone",
85 |_self: R<::bevy_time::Timer>| {
86 let output: V<::bevy_time::Timer> = {
87 {
88 let output: V<::bevy_time::Timer> = <::bevy_time::Timer as ::core::clone::Clone>::clone(
89 &_self,
90 )
91 .into();
92 output
93 }
94 };
95 output
96 },
97 "",
98 &["_self"],
99 )
100 .register_documented(
101 "duration",
102 |_self: R<::bevy_time::Timer>| {
103 let output: V<::core::time::Duration> = {
104 {
105 let output: V<::core::time::Duration> = ::bevy_time::Timer::duration(
106 &_self,
107 )
108 .into();
109 output
110 }
111 };
112 output
113 },
114 " Returns the duration of the timer.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let timer = Timer::new(Duration::from_secs(1), TimerMode::Once);\n assert_eq!(timer.duration(), Duration::from_secs(1));\n ```",
115 &["_self"],
116 )
117 .register_documented(
118 "elapsed",
119 |_self: R<::bevy_time::Timer>| {
120 let output: V<::core::time::Duration> = {
121 {
122 let output: V<::core::time::Duration> = ::bevy_time::Timer::elapsed(
123 &_self,
124 )
125 .into();
126 output
127 }
128 };
129 output
130 },
131 " Returns the time elapsed on the timer. Guaranteed to be between 0.0 and `duration`.\n Will only equal `duration` when the timer is finished and non repeating.\n See also [`Stopwatch::elapsed`](Stopwatch::elapsed).\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.elapsed(), Duration::from_secs_f32(0.5));\n ```",
132 &["_self"],
133 )
134 .register_documented(
135 "elapsed_secs",
136 |_self: R<::bevy_time::Timer>| {
137 let output: f32 = {
138 {
139 let output: f32 = ::bevy_time::Timer::elapsed_secs(&_self)
140 .into();
141 output
142 }
143 };
144 output
145 },
146 " Returns the time elapsed on the timer as an `f32`.\n See also [`Timer::elapsed`](Timer::elapsed).",
147 &["_self"],
148 )
149 .register_documented(
150 "elapsed_secs_f64",
151 |_self: R<::bevy_time::Timer>| {
152 let output: f64 = {
153 {
154 let output: f64 = ::bevy_time::Timer::elapsed_secs_f64(&_self)
155 .into();
156 output
157 }
158 };
159 output
160 },
161 " Returns the time elapsed on the timer as an `f64`.\n See also [`Timer::elapsed`](Timer::elapsed).",
162 &["_self"],
163 )
164 .register_documented(
165 "eq",
166 |_self: R<::bevy_time::Timer>, other: R<::bevy_time::Timer>| {
167 let output: bool = {
168 {
169 let output: bool = <::bevy_time::Timer as ::core::cmp::PartialEq<
170 ::bevy_time::Timer,
171 >>::eq(&_self, &other)
172 .into();
173 output
174 }
175 };
176 output
177 },
178 "",
179 &["_self", "other"],
180 )
181 .register_documented(
182 "finish",
183 |mut _self: M<::bevy_time::Timer>| {
184 let output: () = {
185 {
186 let output: () = ::bevy_time::Timer::finish(&mut _self).into();
187 output
188 }
189 };
190 output
191 },
192 " Finishes the timer.\n # Examples\n ```\n # use bevy_time::*;\n let mut timer = Timer::from_seconds(1.5, TimerMode::Once);\n timer.finish();\n assert!(timer.is_finished());\n ```",
193 &["_self"],
194 )
195 .register_documented(
196 "fraction",
197 |_self: R<::bevy_time::Timer>| {
198 let output: f32 = {
199 {
200 let output: f32 = ::bevy_time::Timer::fraction(&_self).into();
201 output
202 }
203 };
204 output
205 },
206 " Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0).\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(2.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.fraction(), 0.25);\n ```",
207 &["_self"],
208 )
209 .register_documented(
210 "fraction_remaining",
211 |_self: R<::bevy_time::Timer>| {
212 let output: f32 = {
213 {
214 let output: f32 = ::bevy_time::Timer::fraction_remaining(&_self)
215 .into();
216 output
217 }
218 };
219 output
220 },
221 " Returns the fraction of the timer remaining time (goes from 1.0 to 0.0).\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(2.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.fraction_remaining(), 0.75);\n ```",
222 &["_self"],
223 )
224 .register_documented(
225 "from_seconds",
226 |duration: f32, mode: V<::bevy_time::TimerMode>| {
227 let output: V<::bevy_time::Timer> = {
228 {
229 let output: V<::bevy_time::Timer> = ::bevy_time::Timer::from_seconds(
230 duration,
231 mode.into_inner(),
232 )
233 .into();
234 output
235 }
236 };
237 output
238 },
239 " Creates a new timer with a given duration in seconds.\n # Example\n ```\n # use bevy_time::*;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n ```",
240 &["duration", "mode"],
241 )
242 .register_documented(
243 "is_finished",
244 |_self: R<::bevy_time::Timer>| {
245 let output: bool = {
246 {
247 let output: bool = ::bevy_time::Timer::is_finished(&_self)
248 .into();
249 output
250 }
251 };
252 output
253 },
254 " Returns `true` if the timer has reached its duration.\n For repeating timers, this method behaves identically to [`Timer::just_finished`].\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer_once = Timer::from_seconds(1.0, TimerMode::Once);\n timer_once.tick(Duration::from_secs_f32(1.5));\n assert!(timer_once.is_finished());\n timer_once.tick(Duration::from_secs_f32(0.5));\n assert!(timer_once.is_finished());\n let mut timer_repeating = Timer::from_seconds(1.0, TimerMode::Repeating);\n timer_repeating.tick(Duration::from_secs_f32(1.1));\n assert!(timer_repeating.is_finished());\n timer_repeating.tick(Duration::from_secs_f32(0.8));\n assert!(!timer_repeating.is_finished());\n timer_repeating.tick(Duration::from_secs_f32(0.6));\n assert!(timer_repeating.is_finished());\n ```",
255 &["_self"],
256 )
257 .register_documented(
258 "is_paused",
259 |_self: R<::bevy_time::Timer>| {
260 let output: bool = {
261 {
262 let output: bool = ::bevy_time::Timer::is_paused(&_self).into();
263 output
264 }
265 };
266 output
267 },
268 " Returns `true` if the timer is paused.\n See also [`Stopwatch::is_paused`](Stopwatch::is_paused).\n # Examples\n ```\n # use bevy_time::*;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n assert!(!timer.is_paused());\n timer.pause();\n assert!(timer.is_paused());\n timer.unpause();\n assert!(!timer.is_paused());\n ```",
269 &["_self"],
270 )
271 .register_documented(
272 "just_finished",
273 |_self: R<::bevy_time::Timer>| {
274 let output: bool = {
275 {
276 let output: bool = ::bevy_time::Timer::just_finished(&_self)
277 .into();
278 output
279 }
280 };
281 output
282 },
283 " Returns `true` only on the tick the timer reached its duration.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(1.5));\n assert!(timer.just_finished());\n timer.tick(Duration::from_secs_f32(0.5));\n assert!(!timer.just_finished());\n ```",
284 &["_self"],
285 )
286 .register_documented(
287 "mode",
288 |_self: R<::bevy_time::Timer>| {
289 let output: V<::bevy_time::TimerMode> = {
290 {
291 let output: V<::bevy_time::TimerMode> = ::bevy_time::Timer::mode(
292 &_self,
293 )
294 .into();
295 output
296 }
297 };
298 output
299 },
300 " Returns the mode of the timer.\n # Examples\n ```\n # use bevy_time::*;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating);\n assert_eq!(timer.mode(), TimerMode::Repeating);\n ```",
301 &["_self"],
302 )
303 .register_documented(
304 "new",
305 |duration: V<::core::time::Duration>, mode: V<::bevy_time::TimerMode>| {
306 let output: V<::bevy_time::Timer> = {
307 {
308 let output: V<::bevy_time::Timer> = ::bevy_time::Timer::new(
309 duration.into_inner(),
310 mode.into_inner(),
311 )
312 .into();
313 output
314 }
315 };
316 output
317 },
318 " Creates a new timer with a given duration.\n See also [`Timer::from_seconds`](Timer::from_seconds).",
319 &["duration", "mode"],
320 )
321 .register_documented(
322 "pause",
323 |mut _self: M<::bevy_time::Timer>| {
324 let output: () = {
325 {
326 let output: () = ::bevy_time::Timer::pause(&mut _self).into();
327 output
328 }
329 };
330 output
331 },
332 " Pauses the Timer. Disables the ticking of the timer.\n See also [`Stopwatch::pause`](Stopwatch::pause).\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n timer.pause();\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.elapsed_secs(), 0.0);\n ```",
333 &["_self"],
334 )
335 .register_documented(
336 "remaining",
337 |_self: R<::bevy_time::Timer>| {
338 let output: V<::core::time::Duration> = {
339 {
340 let output: V<::core::time::Duration> = ::bevy_time::Timer::remaining(
341 &_self,
342 )
343 .into();
344 output
345 }
346 };
347 output
348 },
349 " Returns the remaining time using Duration\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(2.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5));\n ```",
350 &["_self"],
351 )
352 .register_documented(
353 "remaining_secs",
354 |_self: R<::bevy_time::Timer>| {
355 let output: f32 = {
356 {
357 let output: f32 = ::bevy_time::Timer::remaining_secs(&_self)
358 .into();
359 output
360 }
361 };
362 output
363 },
364 " Returns the remaining time in seconds\n # Examples\n ```\n # use bevy_time::*;\n use std::cmp::Ordering;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(2.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(0.5));\n let result = timer.remaining_secs().total_cmp(&1.5);\n assert_eq!(Ordering::Equal, result);\n ```",
365 &["_self"],
366 )
367 .register_documented(
368 "reset",
369 |mut _self: M<::bevy_time::Timer>| {
370 let output: () = {
371 {
372 let output: () = ::bevy_time::Timer::reset(&mut _self).into();
373 output
374 }
375 };
376 output
377 },
378 " Resets the timer. The reset doesn't affect the `paused` state of the timer.\n See also [`Stopwatch::reset`](Stopwatch::reset).\n Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n timer.tick(Duration::from_secs_f32(1.5));\n timer.reset();\n assert!(!timer.is_finished());\n assert!(!timer.just_finished());\n assert_eq!(timer.elapsed_secs(), 0.0);\n ```",
379 &["_self"],
380 )
381 .register_documented(
382 "set_duration",
383 |mut _self: M<::bevy_time::Timer>, duration: V<::core::time::Duration>| {
384 let output: () = {
385 {
386 let output: () = ::bevy_time::Timer::set_duration(
387 &mut _self,
388 duration.into_inner(),
389 )
390 .into();
391 output
392 }
393 };
394 output
395 },
396 " Sets the duration of the timer.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.5, TimerMode::Once);\n timer.set_duration(Duration::from_secs(1));\n assert_eq!(timer.duration(), Duration::from_secs(1));\n ```",
397 &["_self", "duration"],
398 )
399 .register_documented(
400 "set_elapsed",
401 |mut _self: M<::bevy_time::Timer>, time: V<::core::time::Duration>| {
402 let output: () = {
403 {
404 let output: () = ::bevy_time::Timer::set_elapsed(
405 &mut _self,
406 time.into_inner(),
407 )
408 .into();
409 output
410 }
411 };
412 output
413 },
414 " Sets the elapsed time of the timer without any other considerations.\n See also [`Stopwatch::set`](Stopwatch::set).\n #\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n timer.set_elapsed(Duration::from_secs(2));\n assert_eq!(timer.elapsed(), Duration::from_secs(2));\n // the timer is not finished even if the elapsed time is greater than the duration.\n assert!(!timer.is_finished());\n ```",
415 &["_self", "time"],
416 )
417 .register_documented(
418 "set_mode",
419 |mut _self: M<::bevy_time::Timer>, mode: V<::bevy_time::TimerMode>| {
420 let output: () = {
421 {
422 let output: () = ::bevy_time::Timer::set_mode(
423 &mut _self,
424 mode.into_inner(),
425 )
426 .into();
427 output
428 }
429 };
430 output
431 },
432 " Sets the mode of the timer.\n # Examples\n ```\n # use bevy_time::*;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating);\n timer.set_mode(TimerMode::Once);\n assert_eq!(timer.mode(), TimerMode::Once);\n ```",
433 &["_self", "mode"],
434 )
435 .register_documented(
436 "times_finished_this_tick",
437 |_self: R<::bevy_time::Timer>| {
438 let output: u32 = {
439 {
440 let output: u32 = ::bevy_time::Timer::times_finished_this_tick(
441 &_self,
442 )
443 .into();
444 output
445 }
446 };
447 output
448 },
449 " Returns the number of times a repeating timer\n finished during the last [`tick`](Timer<T>::tick) call.\n For non repeating-timers, this method will only ever\n return 0 or 1.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating);\n timer.tick(Duration::from_secs_f32(6.0));\n assert_eq!(timer.times_finished_this_tick(), 6);\n timer.tick(Duration::from_secs_f32(2.0));\n assert_eq!(timer.times_finished_this_tick(), 2);\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.times_finished_this_tick(), 0);\n ```",
450 &["_self"],
451 )
452 .register_documented(
453 "unpause",
454 |mut _self: M<::bevy_time::Timer>| {
455 let output: () = {
456 {
457 let output: () = ::bevy_time::Timer::unpause(&mut _self).into();
458 output
459 }
460 };
461 output
462 },
463 " Unpauses the Timer. Resumes the ticking of the timer.\n See also [`Stopwatch::unpause()`](Stopwatch::unpause).\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut timer = Timer::from_seconds(1.0, TimerMode::Once);\n timer.pause();\n timer.tick(Duration::from_secs_f32(0.5));\n timer.unpause();\n timer.tick(Duration::from_secs_f32(0.5));\n assert_eq!(timer.elapsed_secs(), 0.5);\n ```",
464 &["_self"],
465 );
466 let registry = world.get_resource_or_init::<AppTypeRegistry>();
467 let mut registry = registry.write();
468 registry
469 .register_type_data::<::bevy_time::Timer, bevy_mod_scripting_bindings::MarkAsGenerated>();
470}
471pub(crate) fn register_timer_mode_functions(world: &mut World) {
472 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<
473 ::bevy_time::TimerMode,
474 >::new(world)
475 .register_documented(
476 "clone",
477 |_self: R<::bevy_time::TimerMode>| {
478 let output: V<::bevy_time::TimerMode> = {
479 {
480 let output: V<::bevy_time::TimerMode> = <::bevy_time::TimerMode as ::core::clone::Clone>::clone(
481 &_self,
482 )
483 .into();
484 output
485 }
486 };
487 output
488 },
489 "",
490 &["_self"],
491 )
492 .register_documented(
493 "eq",
494 |_self: R<::bevy_time::TimerMode>, other: R<::bevy_time::TimerMode>| {
495 let output: bool = {
496 {
497 let output: bool = <::bevy_time::TimerMode as ::core::cmp::PartialEq<
498 ::bevy_time::TimerMode,
499 >>::eq(&_self, &other)
500 .into();
501 output
502 }
503 };
504 output
505 },
506 "",
507 &["_self", "other"],
508 );
509 let registry = world.get_resource_or_init::<AppTypeRegistry>();
510 let mut registry = registry.write();
511 registry
512 .register_type_data::<::bevy_time::TimerMode, bevy_mod_scripting_bindings::MarkAsGenerated>(
513 );
514}
515pub(crate) fn register_virtual_functions(world: &mut World) {
516 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<
517 ::bevy_time::Virtual,
518 >::new(world)
519 .register_documented(
520 "clone",
521 |_self: R<::bevy_time::Virtual>| {
522 let output: V<::bevy_time::Virtual> = {
523 {
524 let output: V<::bevy_time::Virtual> = <::bevy_time::Virtual as ::core::clone::Clone>::clone(
525 &_self,
526 )
527 .into();
528 output
529 }
530 };
531 output
532 },
533 "",
534 &["_self"],
535 );
536 let registry = world.get_resource_or_init::<AppTypeRegistry>();
537 let mut registry = registry.write();
538 registry
539 .register_type_data::<::bevy_time::Virtual, bevy_mod_scripting_bindings::MarkAsGenerated>();
540}
541pub(crate) fn register_delayed_command_queue_functions(world: &mut World) {
542 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<
543 ::bevy_time::DelayedCommandQueue,
544 >::new(world);
545 let registry = world.get_resource_or_init::<AppTypeRegistry>();
546 let mut registry = registry.write();
547 registry
548 .register_type_data::<
549 ::bevy_time::DelayedCommandQueue,
550 bevy_mod_scripting_bindings::MarkAsGenerated,
551 >();
552}
553pub(crate) fn register_stopwatch_functions(world: &mut World) {
554 bevy_mod_scripting_bindings::function::namespace::NamespaceBuilder::<
555 ::bevy_time::Stopwatch,
556 >::new(world)
557 .register_documented(
558 "clone",
559 |_self: R<::bevy_time::Stopwatch>| {
560 let output: V<::bevy_time::Stopwatch> = {
561 {
562 let output: V<::bevy_time::Stopwatch> = <::bevy_time::Stopwatch as ::core::clone::Clone>::clone(
563 &_self,
564 )
565 .into();
566 output
567 }
568 };
569 output
570 },
571 "",
572 &["_self"],
573 )
574 .register_documented(
575 "elapsed",
576 |_self: R<::bevy_time::Stopwatch>| {
577 let output: V<::core::time::Duration> = {
578 {
579 let output: V<::core::time::Duration> = ::bevy_time::Stopwatch::elapsed(
580 &_self,
581 )
582 .into();
583 output
584 }
585 };
586 output
587 },
588 " Returns the elapsed time since the last [`reset`](Stopwatch::reset)\n of the stopwatch.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut stopwatch = Stopwatch::new();\n stopwatch.tick(Duration::from_secs(1));\n assert_eq!(stopwatch.elapsed(), Duration::from_secs(1));\n ```\n # See Also\n [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` value is desirable instead.\n [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead.",
589 &["_self"],
590 )
591 .register_documented(
592 "elapsed_secs",
593 |_self: R<::bevy_time::Stopwatch>| {
594 let output: f32 = {
595 {
596 let output: f32 = ::bevy_time::Stopwatch::elapsed_secs(&_self)
597 .into();
598 output
599 }
600 };
601 output
602 },
603 " Returns the elapsed time since the last [`reset`](Stopwatch::reset)\n of the stopwatch, in seconds.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut stopwatch = Stopwatch::new();\n stopwatch.tick(Duration::from_secs(1));\n assert_eq!(stopwatch.elapsed_secs(), 1.0);\n ```\n # See Also\n [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead.\n [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead.",
604 &["_self"],
605 )
606 .register_documented(
607 "elapsed_secs_f64",
608 |_self: R<::bevy_time::Stopwatch>| {
609 let output: f64 = {
610 {
611 let output: f64 = ::bevy_time::Stopwatch::elapsed_secs_f64(
612 &_self,
613 )
614 .into();
615 output
616 }
617 };
618 output
619 },
620 " Returns the elapsed time since the last [`reset`](Stopwatch::reset)\n of the stopwatch, in seconds, as `f64`.\n # See Also\n [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead.\n [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` is desirable instead.",
621 &["_self"],
622 )
623 .register_documented(
624 "eq",
625 |_self: R<::bevy_time::Stopwatch>, other: R<::bevy_time::Stopwatch>| {
626 let output: bool = {
627 {
628 let output: bool = <::bevy_time::Stopwatch as ::core::cmp::PartialEq<
629 ::bevy_time::Stopwatch,
630 >>::eq(&_self, &other)
631 .into();
632 output
633 }
634 };
635 output
636 },
637 "",
638 &["_self", "other"],
639 )
640 .register_documented(
641 "is_paused",
642 |_self: R<::bevy_time::Stopwatch>| {
643 let output: bool = {
644 {
645 let output: bool = ::bevy_time::Stopwatch::is_paused(&_self)
646 .into();
647 output
648 }
649 };
650 output
651 },
652 " Returns `true` if the stopwatch is paused.\n # Examples\n ```\n # use bevy_time::*;\n let mut stopwatch = Stopwatch::new();\n assert!(!stopwatch.is_paused());\n stopwatch.pause();\n assert!(stopwatch.is_paused());\n stopwatch.unpause();\n assert!(!stopwatch.is_paused());\n ```",
653 &["_self"],
654 )
655 .register_documented(
656 "new",
657 || {
658 let output: V<::bevy_time::Stopwatch> = {
659 {
660 let output: V<::bevy_time::Stopwatch> = ::bevy_time::Stopwatch::new()
661 .into();
662 output
663 }
664 };
665 output
666 },
667 " Create a new unpaused `Stopwatch` with no elapsed time.\n # Examples\n ```\n # use bevy_time::*;\n let stopwatch = Stopwatch::new();\n assert_eq!(stopwatch.elapsed_secs(), 0.0);\n assert_eq!(stopwatch.is_paused(), false);\n ```",
668 &[],
669 )
670 .register_documented(
671 "pause",
672 |mut _self: M<::bevy_time::Stopwatch>| {
673 let output: () = {
674 {
675 let output: () = ::bevy_time::Stopwatch::pause(&mut _self)
676 .into();
677 output
678 }
679 };
680 output
681 },
682 " Pauses the stopwatch. Any call to [`tick`](Stopwatch::tick) while\n paused will not have any effect on the elapsed time.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut stopwatch = Stopwatch::new();\n stopwatch.pause();\n stopwatch.tick(Duration::from_secs_f32(1.5));\n assert!(stopwatch.is_paused());\n assert_eq!(stopwatch.elapsed_secs(), 0.0);\n ```",
683 &["_self"],
684 )
685 .register_documented(
686 "reset",
687 |mut _self: M<::bevy_time::Stopwatch>| {
688 let output: () = {
689 {
690 let output: () = ::bevy_time::Stopwatch::reset(&mut _self)
691 .into();
692 output
693 }
694 };
695 output
696 },
697 " Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut stopwatch = Stopwatch::new();\n stopwatch.tick(Duration::from_secs_f32(1.5));\n stopwatch.reset();\n assert_eq!(stopwatch.elapsed_secs(), 0.0);\n ```",
698 &["_self"],
699 )
700 .register_documented(
701 "set_elapsed",
702 |mut _self: M<::bevy_time::Stopwatch>, time: V<::core::time::Duration>| {
703 let output: () = {
704 {
705 let output: () = ::bevy_time::Stopwatch::set_elapsed(
706 &mut _self,
707 time.into_inner(),
708 )
709 .into();
710 output
711 }
712 };
713 output
714 },
715 " Sets the elapsed time of the stopwatch.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut stopwatch = Stopwatch::new();\n stopwatch.set_elapsed(Duration::from_secs_f32(1.0));\n assert_eq!(stopwatch.elapsed_secs(), 1.0);\n ```",
716 &["_self", "time"],
717 )
718 .register_documented(
719 "unpause",
720 |mut _self: M<::bevy_time::Stopwatch>| {
721 let output: () = {
722 {
723 let output: () = ::bevy_time::Stopwatch::unpause(&mut _self)
724 .into();
725 output
726 }
727 };
728 output
729 },
730 " Unpauses the stopwatch. Resume the effect of ticking on elapsed time.\n # Examples\n ```\n # use bevy_time::*;\n use std::time::Duration;\n let mut stopwatch = Stopwatch::new();\n stopwatch.pause();\n stopwatch.tick(Duration::from_secs_f32(1.0));\n stopwatch.unpause();\n stopwatch.tick(Duration::from_secs_f32(1.0));\n assert!(!stopwatch.is_paused());\n assert_eq!(stopwatch.elapsed_secs(), 1.0);\n ```",
731 &["_self"],
732 );
733 let registry = world.get_resource_or_init::<AppTypeRegistry>();
734 let mut registry = registry.write();
735 registry
736 .register_type_data::<::bevy_time::Stopwatch, bevy_mod_scripting_bindings::MarkAsGenerated>(
737 );
738}
739impl Plugin for BevyTimeScriptingPlugin {
740 fn build(&self, app: &mut App) {
741 let mut world = app.world_mut();
742 register_fixed_functions(&mut world);
743 register_real_functions(&mut world);
744 register_timer_functions(&mut world);
745 register_timer_mode_functions(&mut world);
746 register_virtual_functions(&mut world);
747 register_delayed_command_queue_functions(&mut world);
748 register_stopwatch_functions(&mut world);
749 }
750}