pub struct Size { /* private fields */ }Expand description
Represents the size (width and height) of an image.
Implementations§
Source§impl Size
impl Size
Sourcepub const fn new(width: u32, height: u32) -> Self
pub const fn new(width: u32, height: u32) -> Self
Creates a new Size with the given width and height.
§Arguments
width- The width of the image in pixels.height- The height of the image in pixels.
Sourcepub const fn square(size: u32) -> Self
pub const fn square(size: u32) -> Self
Creates a new Size with equal width and height (a square).
§Arguments
size- The width and height of the square image in pixels.
Sourcepub const fn pixel_count(&self) -> u64
pub const fn pixel_count(&self) -> u64
Returns the total number of pixels (width × height).
Trait Implementations§
impl Copy for Size
Source§impl<'de> Deserialize<'de> for Size
impl<'de> Deserialize<'de> for Size
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
impl Eq for Size
Source§impl Ord for Size
impl Ord for Size
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Size
impl PartialOrd 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 UnsafeUnpin 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