pub struct Size<T = f32> {
pub w: T,
pub h: T,
}
Expand description
Size.
Fields§
§w: T
Width.
h: T
Height.
Implementations§
source§impl Size<f32>
impl Size<f32>
sourcepub fn expand(self) -> Size
pub fn expand(self) -> Size
Returns a new Size
, with width
and height
rounded away from zero to the nearest
integer, unless they are already an integer.
Examples
use rgx::math::Size;
let size_pos = Size::new(3.3, 3.6).expand();
assert_eq!(size_pos.w, 4.0);
assert_eq!(size_pos.h, 4.0);
let size_neg = Size::new(-3.3, -3.6).expand();
assert_eq!(size_neg.w, -4.0);
assert_eq!(size_neg.h, -4.0);
Trait Implementations§
source§impl From<LogicalSize> for Size
impl From<LogicalSize> for Size
source§fn from(other: LogicalSize) -> Self
fn from(other: LogicalSize) -> Self
Converts to this type from the input type.
source§impl<T: PartialEq> PartialEq<Size<T>> for Size<T>
impl<T: PartialEq> PartialEq<Size<T>> for Size<T>
impl<T: Copy> Copy for Size<T>
impl<T: Eq> Eq for Size<T>
impl<T> StructuralEq for Size<T>
impl<T> StructuralPartialEq for Size<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Size<T>where T: RefUnwindSafe,
impl<T> Send for Size<T>where T: Send,
impl<T> Sync for Size<T>where T: Sync,
impl<T> Unpin for Size<T>where T: Unpin,
impl<T> UnwindSafe for Size<T>where T: UnwindSafe,
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