summaryrefslogtreecommitdiff
path: root/src/engine/size.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-03-30 20:51:09 +0100
committerLaurenz <laurmaedje@gmail.com>2019-03-30 20:58:46 +0100
commit5ca303ecadff190800dd55a5a5ae224dc28a3920 (patch)
treea49504b831981de1041a3f7f0ca44a3892f14ef1 /src/engine/size.rs
parentadfd7dd0735d8a4efeac634c53bbf386e91a4c41 (diff)
Make things more consistent ♻
Diffstat (limited to 'src/engine/size.rs')
-rw-r--r--src/engine/size.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/engine/size.rs b/src/engine/size.rs
index f66641c0..bf79a3c4 100644
--- a/src/engine/size.rs
+++ b/src/engine/size.rs
@@ -5,7 +5,7 @@ use std::ops::*;
/// A general size (unit of length) type.
-#[derive(Copy, Clone, PartialEq)]
+#[derive(Copy, Clone, PartialEq, Default)]
pub struct Size {
/// The size in typographic points (1/72 inches).
points: f32,
@@ -62,6 +62,7 @@ impl Debug for Size {
}
impl PartialOrd for Size {
+ #[inline]
fn partial_cmp(&self, other: &Size) -> Option<Ordering> {
self.points.partial_cmp(&other.points)
}
@@ -70,12 +71,14 @@ impl PartialOrd for Size {
impl Neg for Size {
type Output = Size;
+ #[inline]
fn neg(self) -> Size {
Size { points: -self.points }
}
}
impl Sum for Size {
+ #[inline]
fn sum<I>(iter: I) -> Size where I: Iterator<Item=Size> {
iter.fold(Size::zero(), Add::add)
}