summaryrefslogtreecommitdiff
path: root/src/geom/align.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-17 14:41:46 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-17 14:41:46 +0200
commit551ea99d05166b0be50792f767ddd38b996e32fa (patch)
treeec5e86a087e79e8c181c7d4b904216a775227e2d /src/geom/align.rs
parent46aace78ac4ac1c075b9b1670dbb7372df1a0a82 (diff)
Show default values in documentation
Fixes #169 Fixes #1102
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)]