Skip to main content

graphitepdf_primitives/
units.rs

1#[derive(Clone, Copy, Debug, Default, PartialEq, PartialOrd)]
2pub struct Pt(pub f32);
3
4impl Pt {
5    pub const fn new(value: f32) -> Self {
6        Self(value)
7    }
8
9    pub const fn zero() -> Self {
10        Self(0.0)
11    }
12
13    pub const fn value(self) -> f32 {
14        self.0
15    }
16}
17
18impl From<f32> for Pt {
19    fn from(value: f32) -> Self {
20        Self(value)
21    }
22}