From 0600c382feaa05e16dc032308336221bbe7821a1 Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Sun, 26 Oct 2025 16:18:28 +0100 Subject: [PATCH 1/2] image square dimensions --- bingus/Cargo.toml | 2 +- bingus/src/img/image.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bingus/Cargo.toml b/bingus/Cargo.toml index 824c2e8..01af6b0 100644 --- a/bingus/Cargo.toml +++ b/bingus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bingus" -version = "0.6.0" +version = "0.7.0" edition.workspace = true license.workspace = true description.workspace = true diff --git a/bingus/src/img/image.rs b/bingus/src/img/image.rs index f8edff5..e894350 100644 --- a/bingus/src/img/image.rs +++ b/bingus/src/img/image.rs @@ -35,6 +35,15 @@ pub struct Dimensions { pub height: u32, } +impl Dimensions { + pub fn square(width: u32) -> Self { + Self { + width, + height: width, + } + } +} + impl Div for Dimensions { type Output = Dimensions; fn div(self, rhs: Dimensions) -> Self::Output { From f09a02a58d8e7bf2bdd3e7209d80f3be4fe2787d Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Sun, 26 Oct 2025 16:45:07 +0100 Subject: [PATCH 2/2] Dimensions equality --- bingus/Cargo.toml | 2 +- bingus/src/img/image.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bingus/Cargo.toml b/bingus/Cargo.toml index 01af6b0..f09e84b 100644 --- a/bingus/Cargo.toml +++ b/bingus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bingus" -version = "0.7.0" +version = "0.8.0" edition.workspace = true license.workspace = true description.workspace = true diff --git a/bingus/src/img/image.rs b/bingus/src/img/image.rs index e894350..f17ae29 100644 --- a/bingus/src/img/image.rs +++ b/bingus/src/img/image.rs @@ -29,6 +29,7 @@ where } } +#[derive(PartialEq, Eq)] #[cfg_attr(debug_assertions, derive(Debug))] pub struct Dimensions { pub width: u32,