pub struct Rect {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}Expand description
A pixel-space axis-aligned rectangle.
Uses inclusive-left / exclusive-right / inclusive-top / exclusive-
bottom conventions, matching Windows RECT. A monitor whose upper-
left is (0, 0) and whose size is 1920 x 1080 therefore has
right = 1920 and bottom = 1080.
Fields§
§left: i32§top: i32§right: i32§bottom: i32Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn new(left: i32, top: i32, right: i32, bottom: i32) -> Self
pub const fn new(left: i32, top: i32, right: i32, bottom: i32) -> Self
Construct a Rect from its four edges.
Sourcepub const fn from_origin_size(
left: i32,
top: i32,
width: i32,
height: i32,
) -> Self
pub const fn from_origin_size( left: i32, top: i32, width: i32, height: i32, ) -> Self
Construct a Rect from its top-left corner and its size.
pub const fn width(&self) -> i32
pub const fn height(&self) -> i32
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 UnsafeUnpin 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