summaryrefslogtreecommitdiff
path: root/src/geom/align.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/geom/align.rs')
-rw-r--r--src/geom/align.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/geom/align.rs b/src/geom/align.rs
index a15ec4e6..42fc493e 100644
--- a/src/geom/align.rs
+++ b/src/geom/align.rs
@@ -147,6 +147,10 @@ cast_from_value! {
}
cast_to_value! {
+ v: Axes<Align> => v.map(GenAlign::from).into()
+}
+
+cast_to_value! {
v: Axes<Option<GenAlign>> => match (v.x, v.y) {
(Some(x), Some(y)) => Axes::new(x, y).into(),
(Some(x), None) => x.into(),
@@ -196,6 +200,14 @@ impl Fold for GenAlign {
}
}
+impl Fold for Align {
+ type Output = Self;
+
+ fn fold(self, _: Self::Output) -> Self::Output {
+ self
+ }
+}
+
/// Utility struct to restrict a passed alignment value to the horizontal axis
/// on cast.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]