pub struct Size<Num = f64> { /* private fields */ }Expand description
Generic size type. Size is not guaranteed to be non-negative.
Implementations§
Source§impl<Num: Num + Copy> Size<Num>
impl<Num: Num + Copy> Size<Num>
Sourcepub fn half_width(&self) -> Num
pub fn half_width(&self) -> Num
Half width.
Sourcepub fn half_height(&self) -> Num
pub fn half_height(&self) -> Num
Half height.
Sourcepub fn cast<T>(&self) -> Size<T>where
Num: ToPrimitive,
T: NumCast,
pub fn cast<T>(&self) -> Size<T>where
Num: ToPrimitive,
T: NumCast,
Casts the underlying width and height values into the requested type.
Trait Implementations§
Source§impl<'de, Num> Deserialize<'de> for Size<Num>where
Num: Deserialize<'de>,
impl<'de, Num> Deserialize<'de> for Size<Num>where
Num: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<Num: PartialOrd> PartialOrd for Size<Num>
impl<Num: PartialOrd> PartialOrd for Size<Num>
impl<Num: Copy> Copy for Size<Num>
impl<T: Eq> Eq for Size<T>
impl<Num> StructuralPartialEq for Size<Num>
Auto Trait Implementations§
impl<Num> Freeze for Size<Num>where
Num: Freeze,
impl<Num> RefUnwindSafe for Size<Num>where
Num: RefUnwindSafe,
impl<Num> Send for Size<Num>where
Num: Send,
impl<Num> Sync for Size<Num>where
Num: Sync,
impl<Num> Unpin for Size<Num>where
Num: Unpin,
impl<Num> UnwindSafe for Size<Num>where
Num: 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<T> CoordinateMetadata for Twhere
T: ?Sized,
impl<T> CoordinateMetadata for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.