pub struct Rect {
pub origin: Point,
pub size: Size,
}Expand description
A rectangle in logical units.
Fields§
§origin: Point§size: SizeImplementations§
Source§impl Rect
impl Rect
pub const ZERO: Rect
pub const fn new(x: f32, y: f32, width: f32, height: f32) -> Rect
pub fn x(&self) -> f32
pub fn y(&self) -> f32
pub fn width(&self) -> f32
pub fn height(&self) -> f32
pub fn max_x(&self) -> f32
pub fn max_y(&self) -> f32
pub fn offset(&self, by: Point) -> Rect
Sourcepub fn inset(&self, by: Insets) -> Rect
pub fn inset(&self, by: Insets) -> Rect
The rectangle inside these insets, empty if they overlap.
Sourcepub fn intersection(&self, other: &Rect) -> Option<Rect>
pub fn intersection(&self, other: &Rect) -> Option<Rect>
The overlapping area, or None when the rectangles don’t overlap.
Trait Implementations§
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Forget for Rect
impl Freeze for Rect
impl Move 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