pub struct Size {
pub width: u32,
pub height: u32,
}Fields§
§width: u32width
height: u32height
Implementations§
Source§impl Size
impl Size
Sourcepub fn max_dim(&self) -> u32
pub fn max_dim(&self) -> u32
Maximum dimension.
The maximum dimension is computed as the maximum of the width and height.
Sourcepub fn min_dim(&self) -> u32
pub fn min_dim(&self) -> u32
Minimum dimension
The minimum dimension is computed as the minimum of the width and height.
Sourcepub fn aspect_ratio(&self) -> Result<f64, Error>
pub fn aspect_ratio(&self) -> Result<f64, Error>
Compute aspect-ratio of the size.
§Errors
If an arithmetic error (e.g. division by zero) is encountered.
Sourcepub fn scaling_factor(
&self,
size: impl Into<Size>,
mode: ScalingMode,
) -> Result<ScalingFactor, Error>
pub fn scaling_factor( &self, size: impl Into<Size>, mode: ScalingMode, ) -> Result<ScalingFactor, Error>
Compute the scaling factor to scale self to the given size.
§Errors
If an arithmetic error (e.g. division by zero) is encountered.
Trait Implementations§
Source§impl Ord for Size
impl Ord for Size
Source§impl PartialOrd for Size
impl PartialOrd for Size
impl Copy for Size
impl Eq 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