Skip to content

Commit 6f40e09

Browse files
committed
Add some inlines
1 parent bfd2a39 commit 6f40e09

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/bevy_time/src/fixed.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ impl Time<Fixed> {
8484

8585
/// Returns the amount of virtual time that must pass before the fixed
8686
/// timestep schedule is run again.
87+
#[inline]
8788
pub fn timestep(&self) -> Duration {
8889
self.context().timestep
8990
}
@@ -93,6 +94,7 @@ impl Time<Fixed> {
9394
///
9495
/// Takes effect immediately on the next run of the schedule, respecting
9596
/// what is currently in [`Self::overstep`].
97+
#[inline]
9698
pub fn set_timestep(&mut self, timestep: Duration) {
9799
assert_ne!(
98100
timestep,
@@ -111,6 +113,7 @@ impl Time<Fixed> {
111113
///
112114
/// Takes effect immediately on the next run of the schedule, respecting
113115
/// what is currently in [`Self::overstep`].
116+
#[inline]
114117
pub fn set_timestep_seconds(&mut self, seconds: f64) {
115118
assert!(
116119
seconds.is_sign_positive(),
@@ -128,6 +131,7 @@ impl Time<Fixed> {
128131
///
129132
/// Takes effect immediately on the next run of the schedule, respecting
130133
/// what is currently in [`Self::overstep`].
134+
#[inline]
131135
pub fn set_timestep_hz(&mut self, hz: f64) {
132136
assert!(hz.is_sign_positive(), "Hz less than or equal to zero");
133137
assert!(hz.is_finite(), "Hz is infinite");
@@ -136,18 +140,21 @@ impl Time<Fixed> {
136140

137141
/// Returns the amount of overstep time accumulated toward new steps, as
138142
/// [`Duration`](std::time::Duration).
143+
#[inline]
139144
pub fn overstep(&self) -> Duration {
140145
self.context().overstep
141146
}
142147

143148
/// Returns the amount of overstep time accumulated toward new steps, as an
144149
/// [`f32`] fraction of the timestep.
150+
#[inline]
145151
pub fn overstep_percentage(&self) -> f32 {
146152
self.context().overstep.as_secs_f32() / self.context().timestep.as_secs_f32()
147153
}
148154

149155
/// Returns the amount of overstep time accumulated toward new steps, as an
150156
/// [`f64`] fraction of the timestep.
157+
#[inline]
151158
pub fn overstep_percentage_f64(&self) -> f64 {
152159
self.context().overstep.as_secs_f64() / self.context().timestep.as_secs_f64()
153160
}

0 commit comments

Comments
 (0)