pub struct Rect {
pub x1: i32,
pub x2: i32,
pub y1: i32,
pub y2: i32,
}
Expand description
Defines a two-dimensional rectangle.
Fields§
§x1: i32
The X position of the first point (typically the left)
x2: i32
The X position of the second point (typically the right)
y1: i32
The Y position of the first point (typically the top)
y2: i32
The Y position of the second point (typically the bottom)
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn with_size<T>(x: T, y: T, w: T, h: T) -> Rect
pub fn with_size<T>(x: T, y: T, w: T, h: T) -> Rect
Create a new rectangle, specifying X/Y Width/Height
Sourcepub fn with_exact<T>(x1: T, y1: T, x2: T, y2: T) -> Rect
pub fn with_exact<T>(x1: T, y1: T, x2: T, y2: T) -> Rect
Create a new rectangle, specifying exact dimensions
Sourcepub fn point_in_rect(&self, point: Point) -> bool
pub fn point_in_rect(&self, point: Point) -> bool
Returns true if a point is inside the rectangle
Trait Implementations§
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