summaryrefslogtreecommitdiff
path: root/src/geom/relative.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-05-27 14:48:45 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-27 14:48:45 +0200
commitb886ced40825372000df0fa9cddff98a1b642cc6 (patch)
tree6baf23b24c90352f3712f0e8eda57decf913181a /src/geom/relative.rs
parent9e0a34c80f2fa48ada3a0ed0c985c8daa2ae7de3 (diff)
Switch to N64 type alias
Diffstat (limited to 'src/geom/relative.rs')
-rw-r--r--src/geom/relative.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/geom/relative.rs b/src/geom/relative.rs
index 86759bbe..9f8aea55 100644
--- a/src/geom/relative.rs
+++ b/src/geom/relative.rs
@@ -1,4 +1,4 @@
-use decorum::NotNan;
+use decorum::N64;
use super::*;
@@ -7,22 +7,22 @@ use super::*;
/// _Note_: `50%` is represented as `0.5` here, but stored as `50.0` in the
/// corresponding [literal](crate::syntax::Expr::Percent).
#[derive(Default, Copy, Clone, PartialEq, PartialOrd, Hash)]
-pub struct Relative(NotNan<f64>);
+pub struct Relative(N64);
impl Relative {
/// A ratio of `0%` represented as `0.0`.
pub fn zero() -> Self {
- Self(0.0.into())
+ Self(N64::from(0.0))
}
/// A ratio of `100%` represented as `1.0`.
pub fn one() -> Self {
- Self(1.0.into())
+ Self(N64::from(1.0))
}
/// Create a new relative value.
pub fn new(ratio: f64) -> Self {
- Self(ratio.into())
+ Self(N64::from(ratio))
}
/// Get the underlying ratio.