summaryrefslogtreecommitdiffstats
path: root/core/src/length.rs
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-02-17 11:45:34 -0800
committerLibravatar Bingus <shankern@protonmail.com>2023-02-17 11:45:34 -0800
commit744cef5608a91fe55cbbe1adb73a9a0b5e266668 (patch)
treef88ca6ae3c481e2de74178bb3f0d1f1b685e1740 /core/src/length.rs
parent8da098330b58542cc929f4f24d02e26bd654bae4 (diff)
parent7dc1fb488ddbd12519571b51d75ae0c28875911d (diff)
downloadiced-744cef5608a91fe55cbbe1adb73a9a0b5e266668.tar.gz
iced-744cef5608a91fe55cbbe1adb73a9a0b5e266668.tar.bz2
iced-744cef5608a91fe55cbbe1adb73a9a0b5e266668.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts: # winit/src/window.rs
Diffstat (limited to 'core/src/length.rs')
-rw-r--r--core/src/length.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/src/length.rs b/core/src/length.rs
index 95ea6e0e..bb925c4b 100644
--- a/core/src/length.rs
+++ b/core/src/length.rs
@@ -1,5 +1,5 @@
/// The strategy used to fill space in a specific dimension.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Length {
/// Fill all the remaining space
Fill,
@@ -17,7 +17,7 @@ pub enum Length {
Shrink,
/// Fill a fixed amount of space
- Units(u16),
+ Fixed(f32),
}
impl Length {
@@ -31,13 +31,19 @@ impl Length {
Length::Fill => 1,
Length::FillPortion(factor) => *factor,
Length::Shrink => 0,
- Length::Units(_) => 0,
+ Length::Fixed(_) => 0,
}
}
}
+impl From<f32> for Length {
+ fn from(amount: f32) -> Self {
+ Length::Fixed(amount)
+ }
+}
+
impl From<u16> for Length {
fn from(units: u16) -> Self {
- Length::Units(units)
+ Length::Fixed(f32::from(units))
}
}