pub struct Size {
pub width: i32,
pub height: i32,
}
Expand description
Size of a bounding box for a shape.
The width and height must be positive.
Fields§
§width: i32
Horizontal size in pixels.
height: i32
Vertical size in pixels.
Implementations§
Source§impl Size
impl Size
Sourcepub fn new<I: Into<i32>>(width: I, height: I) -> Self
pub fn new<I: Into<i32>>(width: I, height: I) -> Self
Create a new size casting the argument types.
Sourcepub const fn abs(self) -> Self
pub const fn abs(self) -> Self
Set both width and height to their absolute (non-negative) value.
Sourcepub fn component_min(self, other: Self) -> Self
pub fn component_min(self, other: Self) -> Self
Set both width and height to their minimum in the two given points.
Sourcepub fn component_max(self, other: Self) -> Self
pub fn component_max(self, other: Self) -> Self
Set both width and height to their maximum in the two given points.
Trait Implementations§
Source§impl AddAssign<Size> for Point
impl AddAssign<Size> for Point
Source§fn add_assign(&mut self, other: Size)
fn add_assign(&mut self, other: Size)
Performs the
+=
operation. Read moreSource§impl AddAssign for Size
impl AddAssign for Size
Source§fn add_assign(&mut self, other: Size)
fn add_assign(&mut self, other: Size)
Performs the
+=
operation. Read moreSource§impl DivAssign<i32> for Size
impl DivAssign<i32> for Size
Source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the
/=
operation. Read moreSource§impl MulAssign<i32> for Size
impl MulAssign<i32> for Size
Source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the
*=
operation. Read moreSource§impl Ord for Size
impl Ord for Size
Source§impl PartialOrd for Size
impl PartialOrd for Size
Source§impl SubAssign<Size> for Point
impl SubAssign<Size> for Point
Source§fn sub_assign(&mut self, other: Size)
fn sub_assign(&mut self, other: Size)
Performs the
-=
operation. Read moreSource§impl SubAssign for Size
impl SubAssign for Size
Source§fn sub_assign(&mut self, other: Size)
fn sub_assign(&mut self, other: Size)
Performs the
-=
operation. Read moreimpl 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