#[repr(C)]pub struct Size<N, Kind> {
pub w: N,
pub h: N,
/* private fields */
}
Expand description
A size as defined by its width and height
Constructors of this type ensure that the values are always positive via
debug_assert!()
, however manually changing the values of the fields
can break this invariant.
Operations on sizes are saturating.
Fields§
§w: N
horizontal coordinate
h: N
vertical coordinate
Implementations§
Source§impl<N: Coordinate, Kind> Size<N, Kind>
impl<N: Coordinate, Kind> Size<N, Kind>
Source§impl<N: Coordinate, Kind> Size<N, Kind>
impl<N: Coordinate, Kind> Size<N, Kind>
Source§impl<N: Coordinate, Kind> Size<N, Kind>
impl<N: Coordinate, Kind> Size<N, Kind>
Source§impl<N: Coordinate, Kind> Size<N, Kind>
impl<N: Coordinate, Kind> Size<N, Kind>
Source§impl<N: Coordinate, Kind> Size<N, Kind>
impl<N: Coordinate, Kind> Size<N, Kind>
Source§impl<Kind> Size<f64, Kind>
impl<Kind> Size<f64, Kind>
Sourcepub fn to_i32_round<N: Coordinate>(self) -> Size<N, Kind>
pub fn to_i32_round<N: Coordinate>(self) -> Size<N, Kind>
Convert to i32 for integer-space manipulations by rounding float values
Sourcepub fn to_i32_floor<N: Coordinate>(self) -> Size<N, Kind>
pub fn to_i32_floor<N: Coordinate>(self) -> Size<N, Kind>
Convert to i32 for integer-space manipulations by flooring float values
Sourcepub fn to_i32_ceil<N: Coordinate>(self) -> Size<N, Kind>
pub fn to_i32_ceil<N: Coordinate>(self) -> Size<N, Kind>
Convert to i32 for integer-space manipulations by ceiling float values
Source§impl<N: Coordinate> Size<N, Logical>
impl<N: Coordinate> Size<N, Logical>
Sourcepub fn to_physical(self, scale: impl Into<Scale<N>>) -> Size<N, Physical>
pub fn to_physical(self, scale: impl Into<Scale<N>>) -> Size<N, Physical>
Convert this logical size to physical coordinate space according to given scale factor
Sourcepub fn to_physical_precise_round<S: Coordinate, R: Coordinate>(
self,
scale: impl Into<Scale<S>>,
) -> Size<R, Physical>
pub fn to_physical_precise_round<S: Coordinate, R: Coordinate>( self, scale: impl Into<Scale<S>>, ) -> Size<R, Physical>
Convert this logical size to physical coordinate space according to given scale factor and round the result
Sourcepub fn to_physical_precise_ceil<S: Coordinate, R: Coordinate>(
&self,
scale: impl Into<Scale<S>>,
) -> Size<R, Physical>
pub fn to_physical_precise_ceil<S: Coordinate, R: Coordinate>( &self, scale: impl Into<Scale<S>>, ) -> Size<R, Physical>
Convert this logical size to physical coordinate space according to given scale factor and ceil the result
Sourcepub fn to_physical_precise_floor<S: Coordinate, R: Coordinate>(
&self,
scale: impl Into<Scale<S>>,
) -> Size<R, Physical>
pub fn to_physical_precise_floor<S: Coordinate, R: Coordinate>( &self, scale: impl Into<Scale<S>>, ) -> Size<R, Physical>
Convert this logical size to physical coordinate space according to given scale factor and floor the result
Source§impl<N: Coordinate> Size<N, Physical>
impl<N: Coordinate> Size<N, Physical>
Trait Implementations§
Source§impl<N: Coordinate, Kind> Add for Size<N, Kind>
impl<N: Coordinate, Kind> Add for Size<N, Kind>
Source§impl<N: Coordinate, Kind> AddAssign for Size<N, Kind>
impl<N: Coordinate, Kind> AddAssign for Size<N, Kind>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moreSource§impl<N: Coordinate + Div<Output = N>, KindLhs, KindRhs> Div<Size<N, KindRhs>> for Size<N, KindLhs>
impl<N: Coordinate + Div<Output = N>, KindLhs, KindRhs> Div<Size<N, KindRhs>> for Size<N, KindLhs>
Source§impl<N: Coordinate, Kind> Sub for Size<N, Kind>
impl<N: Coordinate, Kind> Sub for Size<N, Kind>
Source§impl<N: Coordinate, Kind> SubAssign for Size<N, Kind>
impl<N: Coordinate, Kind> SubAssign for Size<N, Kind>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read moreimpl<N: Copy, Kind> Copy for Size<N, Kind>
impl<N: Eq, Kind> Eq for Size<N, Kind>
Auto Trait Implementations§
impl<N, Kind> Freeze for Size<N, Kind>where
N: Freeze,
impl<N, Kind> RefUnwindSafe for Size<N, Kind>where
N: RefUnwindSafe,
Kind: RefUnwindSafe,
impl<N, Kind> Send for Size<N, Kind>
impl<N, Kind> Sync for Size<N, Kind>
impl<N, Kind> Unpin for Size<N, Kind>
impl<N, Kind> UnwindSafe for Size<N, Kind>where
N: UnwindSafe,
Kind: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.