From 51bf3268ddf5db1bdd61e59bfb4a30f0463a4bfb Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 10 Oct 2020 22:35:24 +0200 Subject: =?UTF-8?q?Refactor=20text=20state=20=F0=9F=86=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/geom/linear.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/geom') diff --git a/src/geom/linear.rs b/src/geom/linear.rs index 2567d264..d9860d43 100644 --- a/src/geom/linear.rs +++ b/src/geom/linear.rs @@ -11,7 +11,10 @@ pub struct Linear { impl Linear { /// The zero linear. - pub const ZERO: Linear = Linear { rel: Relative::ZERO, abs: Length::ZERO }; + pub const ZERO: Self = Self { rel: Relative::ZERO, abs: Length::ZERO }; + + /// The linear with a relative part of `100%` and no absolute part. + pub const ONE: Self = Self { rel: Relative::ONE, abs: Length::ZERO }; /// Create a new linear. pub fn new(rel: Relative, abs: Length) -> Self { @@ -24,7 +27,7 @@ impl Linear { self.rel.eval(one) + self.abs } - /// Whether this linear's relative component is zero. + /// Whether this linear's relative part is zero. pub fn is_absolute(self) -> bool { self.rel == Relative::ZERO } -- cgit v1.2.3