summaryrefslogtreecommitdiffstats
path: root/core/src/length.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-14 06:46:50 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-14 06:46:50 +0100
commitbc8d347736ec997ec0e0c401289e2bc09e212b8a (patch)
treeb98798c09a3aa914b7d0869fba0cfd3efff7754f /core/src/length.rs
parent839e039dbf2fb89dcb8c141503740777d2af2eb3 (diff)
parent73f3c900071f950ea914652ca3f0002c1e173f61 (diff)
downloadiced-bc8d347736ec997ec0e0c401289e2bc09e212b8a.tar.gz
iced-bc8d347736ec997ec0e0c401289e2bc09e212b8a.tar.bz2
iced-bc8d347736ec997ec0e0c401289e2bc09e212b8a.zip
Merge pull request #52 from hecrj/custom-layout-engine
Custom layout engine
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,
+ }
+ }
+}