Skip to content

Commit 36eedbf

Browse files
EmiOnGitEmi
and
Emi
authored
Change Urect::width & Urect::height to be const (#9640)
# Objective The two functions [`Urect::height`](https://docs.rs/bevy_math/latest/bevy_math/struct.URect.html#method.height), [`Urect::width`](https://docs.rs/bevy_math/latest/bevy_math/struct.URect.html#method.width) are currently not const. Since the methods are very unlikely to change (ever) and are useful to be const for some games, they should be. Co-authored-by: Emi <[email protected]>
1 parent 42e6dc8 commit 36eedbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/bevy_math/src/rects/urect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl URect {
130130
/// assert_eq!(r.width(), 5);
131131
/// ```
132132
#[inline]
133-
pub fn width(&self) -> u32 {
133+
pub const fn width(&self) -> u32 {
134134
self.max.x - self.min.x
135135
}
136136

@@ -144,7 +144,7 @@ impl URect {
144144
/// assert_eq!(r.height(), 1);
145145
/// ```
146146
#[inline]
147-
pub fn height(&self) -> u32 {
147+
pub const fn height(&self) -> u32 {
148148
self.max.y - self.min.y
149149
}
150150

0 commit comments

Comments
 (0)