From 65b525af7ff2823cfe635c4b26d33aad9068e392 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 21 Jul 2024 20:00:02 +0200 Subject: Introduce `markdown::Settings` --- core/src/pixels.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'core/src/pixels.rs') diff --git a/core/src/pixels.rs b/core/src/pixels.rs index f5550a10..a1ea0f15 100644 --- a/core/src/pixels.rs +++ b/core/src/pixels.rs @@ -9,6 +9,11 @@ #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct Pixels(pub f32); +impl Pixels { + /// Zero pixels. + pub const ZERO: Self = Self(0.0); +} + impl From for Pixels { fn from(amount: f32) -> Self { Self(amount) @@ -58,3 +63,19 @@ impl std::ops::Mul for Pixels { Pixels(self.0 * rhs) } } + +impl std::ops::Div for Pixels { + type Output = Pixels; + + fn div(self, rhs: Self) -> Self { + Pixels(self.0 / rhs.0) + } +} + +impl std::ops::Div for Pixels { + type Output = Pixels; + + fn div(self, rhs: f32) -> Self { + Pixels(self.0 / rhs) + } +} -- cgit