Compare commits

...

2 commits

Author SHA1 Message Date
f09a02a58d
Dimensions equality 2025-10-26 16:45:07 +01:00
0600c382fe
image square dimensions 2025-10-26 16:18:28 +01:00
2 changed files with 11 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "bingus" name = "bingus"
version = "0.6.0" version = "0.8.0"
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
description.workspace = true description.workspace = true

View file

@ -29,12 +29,22 @@ where
} }
} }
#[derive(PartialEq, Eq)]
#[cfg_attr(debug_assertions, derive(Debug))] #[cfg_attr(debug_assertions, derive(Debug))]
pub struct Dimensions { pub struct Dimensions {
pub width: u32, pub width: u32,
pub height: u32, pub height: u32,
} }
impl Dimensions {
pub fn square(width: u32) -> Self {
Self {
width,
height: width,
}
}
}
impl Div<Dimensions> for Dimensions { impl Div<Dimensions> for Dimensions {
type Output = Dimensions; type Output = Dimensions;
fn div(self, rhs: Dimensions) -> Self::Output { fn div(self, rhs: Dimensions) -> Self::Output {