#[repr(C)]pub struct Size2D<T> {
pub width: T,
pub height: T,
}
Expand description
A 2d size tagged with a unit.
Fields§
§width: T
The extent of the element in the U
units along the x
axis (usually horizontal).
height: T
The extent of the element in the U
units along the y
axis (usually vertical).
Implementations§
Source§impl<T> Size2D<T>
impl<T> Size2D<T>
Sourcepub fn zero() -> Selfwhere
T: Zero,
pub fn zero() -> Selfwhere
T: Zero,
The same as Zero::zero()
but available without importing trait.
Sourcepub fn splat(v: T) -> Selfwhere
T: Clone,
pub fn splat(v: T) -> Selfwhere
T: Clone,
Constructor setting all components to the same value.
Sourcepub fn from_untyped(p: Size2D<T>) -> Self
pub fn from_untyped(p: Size2D<T>) -> Self
Tag a unitless value with units.
Source§impl<T: Copy> Size2D<T>
impl<T: Copy> Size2D<T>
Sourcepub fn to_array(self) -> [T; 2]
pub fn to_array(self) -> [T; 2]
Return this size as an array of two elements (width, then height).
Sourcepub fn to_tuple(self) -> (T, T)
pub fn to_tuple(self) -> (T, T)
Return this size as a tuple of two elements (width, then height).
Trait Implementations§
Source§impl<T: AddAssign> AddAssign for Size2D<T>
impl<T: AddAssign> AddAssign for Size2D<T>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moreSource§impl<T: Copy + DivAssign> DivAssign<T> for Size2D<T>
impl<T: Copy + DivAssign> DivAssign<T> for Size2D<T>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Performs the
/=
operation. Read moreSource§impl<T: Copy + MulAssign> MulAssign<T> for Size2D<T>
impl<T: Copy + MulAssign> MulAssign<T> for Size2D<T>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Performs the
*=
operation. Read moreSource§impl<T: SubAssign> SubAssign for Size2D<T>
impl<T: SubAssign> SubAssign for Size2D<T>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moreimpl<T: Copy> Copy for Size2D<T>
impl<T> Eq for Size2D<T>where
T: Eq,
Auto Trait Implementations§
impl<T> Freeze for Size2D<T>where
T: Freeze,
impl<T> RefUnwindSafe for Size2D<T>where
T: RefUnwindSafe,
impl<T> Send for Size2D<T>where
T: Send,
impl<T> Sync for Size2D<T>where
T: Sync,
impl<T> Unpin for Size2D<T>where
T: Unpin,
impl<T> UnwindSafe for Size2D<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Fr, To> IntoColor<To> for Frwhere
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Frwhere
To: FromColor<Fr>,
Source§fn into_color(self) -> To
fn into_color(self) -> To
Convert into color