diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-31 19:24:26 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-31 21:15:43 +0300 |
| commit | 88c6778771d8196621072b562466f6e8e68dbbc3 (patch) | |
| tree | 04e4268b1b602f96e2e12316f8dd25ed344202a2 /niri-config | |
| parent | 73f6d3366ee801e27f7c50601117e5e747d88899 (diff) | |
| download | niri-88c6778771d8196621072b562466f6e8e68dbbc3.tar.gz niri-88c6778771d8196621072b562466f6e8e68dbbc3.tar.bz2 niri-88c6778771d8196621072b562466f6e8e68dbbc3.zip | |
Extract SizeChange::from(PresetSize)
Diffstat (limited to 'niri-config')
| -rw-r--r-- | niri-config/src/lib.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index dbf3756d..cfa87a24 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -768,6 +768,15 @@ pub enum PresetSize { Fixed(#[knuffel(argument)] i32), } +impl From<PresetSize> for SizeChange { + fn from(value: PresetSize) -> Self { + match value { + PresetSize::Proportion(prop) => SizeChange::SetProportion(prop * 100.), + PresetSize::Fixed(fixed) => SizeChange::SetFixed(fixed), + } + } +} + #[derive(Debug, Clone, Copy, PartialEq)] pub struct DefaultPresetSize(pub Option<PresetSize>); |
