From 945dfabd7135d1bd44a14e54d95b716642651ed3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 14 Feb 2020 05:35:42 +0100 Subject: Move `Size` to `iced_core` --- native/src/size.rs | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 native/src/size.rs (limited to 'native/src/size.rs') diff --git a/native/src/size.rs b/native/src/size.rs deleted file mode 100644 index 389b3247..00000000 --- a/native/src/size.rs +++ /dev/null @@ -1,51 +0,0 @@ -use std::f32; - -/// An amount of space in 2 dimensions. -#[derive(Debug, Clone, Copy, PartialEq)] -pub struct Size { - /// The width. - pub width: f32, - /// The height. - pub height: f32, -} - -impl Size { - /// A [`Size`] with zero width and height. - /// - /// [`Size`]: struct.Size.html - pub const ZERO: Size = Size::new(0., 0.); - - /// A [`Size`] with infinite width and height. - /// - /// [`Size`]: struct.Size.html - pub const INFINITY: Size = Size::new(f32::INFINITY, f32::INFINITY); - - /// A [`Size`] of infinite width and height. - /// - /// [`Size`]: struct.Size.html - pub const fn new(width: f32, height: f32) -> Self { - Size { width, height } - } - - /// Increments the [`Size`] to account for the given padding. - /// - /// [`Size`]: struct.Size.html - pub fn pad(&self, padding: f32) -> Self { - Size { - width: self.width + padding * 2.0, - height: self.height + padding * 2.0, - } - } -} - -impl From<[f32; 2]> for Size { - fn from([width, height]: [f32; 2]) -> Self { - Size { width, height } - } -} - -impl From<[u16; 2]> for Size { - fn from([width, height]: [u16; 2]) -> Self { - Size::new(width.into(), height.into()) - } -} -- cgit