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 <emanuel.boehm@gmail.com>
This commit is contained in:
Emi 2023-08-30 19:31:30 +02:00 committed by GitHub
parent 42e6dc8987
commit 36eedbfa92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,7 +130,7 @@ impl URect {
/// assert_eq!(r.width(), 5); /// assert_eq!(r.width(), 5);
/// ``` /// ```
#[inline] #[inline]
pub fn width(&self) -> u32 { pub const fn width(&self) -> u32 {
self.max.x - self.min.x self.max.x - self.min.x
} }
@ -144,7 +144,7 @@ impl URect {
/// assert_eq!(r.height(), 1); /// assert_eq!(r.height(), 1);
/// ``` /// ```
#[inline] #[inline]
pub fn height(&self) -> u32 { pub const fn height(&self) -> u32 {
self.max.y - self.min.y self.max.y - self.min.y
} }