summaryrefslogtreecommitdiff
path: root/src/geom/ratio.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-04-08 15:08:26 +0200
committerLaurenz <laurmaedje@gmail.com>2022-04-08 15:45:14 +0200
commit712c00ecb72b67da2c0788e5d3eb4dcc6366b2a7 (patch)
treef5d7ef4341a4728c980d020cc173fa6bb70feaff /src/geom/ratio.rs
parent977ac77e6a3298be2644a8231e93acbef9f7f396 (diff)
Em units
Diffstat (limited to 'src/geom/ratio.rs')
-rw-r--r--src/geom/ratio.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/geom/ratio.rs b/src/geom/ratio.rs
index 7dca53c2..69f06dd2 100644
--- a/src/geom/ratio.rs
+++ b/src/geom/ratio.rs
@@ -3,7 +3,7 @@ use super::*;
/// A ratio of a whole.
///
/// _Note_: `50%` is represented as `0.5` here, but stored as `50.0` in the
-/// corresponding [literal](crate::syntax::ast::LitKind::Percent).
+/// corresponding [literal](crate::syntax::ast::LitKind::Numeric).
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Ratio(Scalar);
@@ -38,13 +38,13 @@ impl Ratio {
self.0 == 1.0
}
- /// The absolute value of the this ratio.
+ /// The absolute value of this ratio.
pub fn abs(self) -> Self {
Self::new(self.get().abs())
}
- /// Resolve this relative to the given `whole`.
- pub fn resolve<T: Numeric>(self, whole: T) -> T {
+ /// Return the ratio of the given `whole`.
+ pub fn of<T: Numeric>(self, whole: T) -> T {
let resolved = whole * self.get();
if resolved.is_finite() { resolved } else { T::zero() }
}