pub struct Rect {
pub x: i32,
pub y: i32,
pub w: i32,
pub h: i32,
}Fields§
§x: i32§y: i32§w: i32§h: i32Implementations§
Source§impl Rect
impl Rect
pub const ZERO: Rect
pub const fn new(x: i32, y: i32, w: i32, h: i32) -> Rect
pub const fn from_size(size: Size) -> Rect
pub const fn origin(self) -> Point
pub const fn size(self) -> Size
pub const fn right(self) -> i32
pub const fn bottom(self) -> i32
pub const fn is_empty(self) -> bool
pub const fn area(self) -> i64
pub const fn contains(self, p: Point) -> bool
pub fn intersect(self, other: Rect) -> Rect
pub fn intersects(self, other: Rect) -> bool
Sourcepub fn union(self, other: Rect) -> Rect
pub fn union(self, other: Rect) -> Rect
Smallest rect covering both. Empty rects are identity elements.
pub const fn translate(self, dx: i32, dy: i32) -> Rect
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