task: rewrite event handling as a step towards event-based subscriptions

This commit is contained in:
2024-12-14 14:53:24 +01:00
parent f9a8b32d3e
commit a0d524b825
8 changed files with 319 additions and 158 deletions

View File

@ -64,19 +64,19 @@ impl<S: CoordinateSpace> Coordinates<S> {
}
}
fn top_left() -> Self {
const fn top_left() -> Self {
Self::new(S::Data::MIN, S::Data::MIN)
}
fn top_right() -> Self {
const fn top_right() -> Self {
Self::new(S::Data::MAX, S::Data::MIN)
}
fn bottom_left() -> Self {
const fn bottom_left() -> Self {
Self::new(S::Data::MIN, S::Data::MAX)
}
fn bottom_right() -> Self {
const fn bottom_right() -> Self {
Self::new(S::Data::MAX, S::Data::MAX)
}
@ -101,15 +101,13 @@ pub struct Rectangle<Space: CoordinateSpace> {
impl<Space: CoordinateSpace> Rectangle<Space> {
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
}
}
pub fn everything() -> Self {
pub const fn everything() -> Self {
Self {
top_left: Coordinates::<Space>::top_left(),
bottom_right: Coordinates::<Space>::bottom_right()