From ebff8eb038706404cb4601cf6853675319663e3f Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 21 Nov 2019 17:23:44 +0100 Subject: =?UTF-8?q?Fix=20spacing=20bugs=20=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/layout/mod.rs') 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. -- cgit v1.2.3