summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-21 17:23:44 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-21 17:50:51 +0100
commitebff8eb038706404cb4601cf6853675319663e3f (patch)
tree2837b41d6a0b23920eed5713887a1639552aed3a /src/layout/mod.rs
parent131e81baaf668f76a7dd1d39a0d88afd5e4582ec (diff)
Fix spacing bugs 🚧
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 2c725e1d..04039d07 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -307,6 +307,19 @@ pub enum Alignment {
End,
}
+#[derive(Debug, Copy, Clone, PartialEq)]
+pub enum SpaceState {
+ Soft(Size),
+ Forbidden,
+ Allowed,
+}
+
+impl SpaceState {
+ fn soft_or_zero(&self) -> Size {
+ if let SpaceState::Soft(space) = self { *space } else { Size::zero() }
+ }
+}
+
/// The error type for layouting.
pub enum LayoutError {
/// An action is unallowed in the active context.