summaryrefslogtreecommitdiffstats
path: root/core/src/length.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/length.rs')
-rw-r--r--core/src/length.rs12
1 files changed, 11 insertions, 1 deletions
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,
+ }
+ }
+}