pub struct Size {
pub w: f32,
pub h: f32,
}Expand description
Width and height in logical pixels.
§Examples
use ailloli_ui_core::Size;
assert_eq!(Size::new(20.0, 10.0), Size { w: 20.0, h: 10.0 });Fields§
§w: f32Width in logical pixels.
h: f32Height in logical pixels.
Implementations§
Source§impl Size
impl Size
Sourcepub fn new(w: f32, h: f32) -> Self
pub fn new(w: f32, h: f32) -> Self
Creates a size (w, h) without rejecting negative or non-finite values.
§Examples
use ailloli_ui_core::Size;
assert_eq!(Size::new(20.0, 10.0).w, 20.0);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true when either dimension is zero or negative.
NaN is not classified as empty because comparisons with it are false.
§Examples
use ailloli_ui_core::Size;
assert!(Size::new(0.0, 10.0).is_empty());Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns the component-wise floating-point minimum.
§Examples
use ailloli_ui_core::Size;
assert_eq!(Size::new(3.0, 8.0).min(Size::new(5.0, 4.0)), Size::new(3.0, 4.0));Sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns the component-wise floating-point maximum.
§Examples
use ailloli_ui_core::Size;
assert_eq!(Size::new(3.0, 8.0).max(Size::new(5.0, 4.0)), Size::new(5.0, 8.0));Trait Implementations§
impl Copy for Size
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more