From 0240c3981b716c82ecb3364945815335b420a63e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 10 Nov 2019 06:05:20 +0100 Subject: Draft custom layout engine based on `druid` --- core/src/length.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'core/src/length.rs') diff --git a/core/src/length.rs b/core/src/length.rs index 0e670038..73c227d8 100644 --- a/core/src/length.rs +++ b/core/src/length.rs @@ -1,7 +1,17 @@ /// The strategy used to fill space in a specific dimension. -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Hash)] pub enum Length { Fill, Shrink, Units(u16), } + +impl Length { + pub fn fill_factor(&self) -> u16 { + match self { + Length::Fill => 1, + Length::Shrink => 0, + Length::Units(_) => 0, + } + } +} -- cgit