Introduce markdown::Settings

This commit is contained in:
Héctor Ramón Jiménez 2024-07-21 20:00:02 +02:00
parent f830454ffa
commit 65b525af7f
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 151 additions and 42 deletions

View file

@ -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)
}
}