summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-21 20:00:02 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-21 20:00:02 +0200
commit65b525af7ff2823cfe635c4b26d33aad9068e392 (patch)
treedbd792192e3cdc90a46c822b73287c1828380eeb /core
parentf830454ffad1cf60f1d6e56fe95514af96848a64 (diff)
downloadiced-65b525af7ff2823cfe635c4b26d33aad9068e392.tar.gz
iced-65b525af7ff2823cfe635c4b26d33aad9068e392.tar.bz2
iced-65b525af7ff2823cfe635c4b26d33aad9068e392.zip
Introduce `markdown::Settings`
Diffstat (limited to '')
-rw-r--r--core/src/pixels.rs21
1 files changed, 21 insertions, 0 deletions
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<f32> for Pixels {
fn from(amount: f32) -> Self {
Self(amount)
@@ -58,3 +63,19 @@ impl std::ops::Mul<f32> 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<f32> for Pixels {
+ type Output = Pixels;
+
+ fn div(self, rhs: f32) -> Self {
+ Pixels(self.0 / rhs)
+ }
+}