pub struct Rect {
pub x: i32,
pub y: i32,
pub width: i32,
pub height: i32,
}
Expand description
Rectangle with integer coordinates
Fields§
§x: i32
§y: i32
§width: i32
§height: i32
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn from_points(tl: Point, br: Point) -> Self
pub fn from_points(tl: Point, br: Point) -> Self
Create rectangle from top-left and bottom-right points
Sourcepub fn from_center_size(center: Point, size: Size) -> Self
pub fn from_center_size(center: Point, size: Size) -> Self
Create rectangle from center point and size
Sourcepub fn contains_rect(&self, other: &Rect) -> bool
pub fn contains_rect(&self, other: &Rect) -> bool
Check if another rectangle is completely inside this one
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rect
impl<'de> Deserialize<'de> for Rect
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 Copy for Rect
impl Eq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
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