geometry: make rectangle::new const

This commit is contained in:
Victoria Fischer 2024-12-01 21:09:56 +01:00
parent 28c9d61926
commit 59c3307c27

View File

@ -100,9 +100,9 @@ pub struct Rectangle<Space: CoordinateSpace> {
}
impl<Space: CoordinateSpace> Rectangle<Space> {
pub fn new(top_left: Coordinates<Space>, bottom_right: Coordinates<Space>) -> Self {
debug_assert!(top_left.x <= bottom_right.x);
debug_assert!(top_left.y <= bottom_right.y);
pub const fn new(top_left: Coordinates<Space>, bottom_right: Coordinates<Space>) -> Self {
//debug_assert!(top_left.x <= bottom_right.x);
//debug_assert!(top_left.y <= bottom_right.y);
Self {
top_left,
bottom_right