pub struct BasicRectangle { /* private fields */ }
Expand description
A basic rectangle implementation. Edges are inclusive.
Trait Implementations§
Source§impl Clone for BasicRectangle
impl Clone for BasicRectangle
Source§fn clone(&self) -> BasicRectangle
fn clone(&self) -> BasicRectangle
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BasicRectangle
impl Debug for BasicRectangle
Source§impl PartialEq for BasicRectangle
impl PartialEq for BasicRectangle
Source§impl Rectangle for BasicRectangle
impl Rectangle for BasicRectangle
Source§fn new_from_sides(left: i32, right: i32, top: i32, bottom: i32) -> Self
fn new_from_sides(left: i32, right: i32, top: i32, bottom: i32) -> Self
Creates a new rectangle from the given sides.
The sides are inclusive. Read more
Source§fn width(&self) -> Self::Unit
fn width(&self) -> Self::Unit
The width of the rectangle.
This is calculated as
right - left
. Read moreSource§fn height(&self) -> Self::Unit
fn height(&self) -> Self::Unit
The height of the rectangle.
This is calculated as
top - bottom
. Read moreSource§fn translate(&self, x: Self::Unit, y: Self::Unit) -> Self
fn translate(&self, x: Self::Unit, y: Self::Unit) -> Self
Translates the rectangle by the given amount.
This is done by adding the given amount to the x and y coordinates. Read more
Source§fn perimeter(&self) -> Self::Unit
fn perimeter(&self) -> Self::Unit
The perimeter of the rectangle.
This is calculated as
(width + height) * 2
. Read moreSource§fn area(&self) -> Self::Unit
fn area(&self) -> Self::Unit
The area of the rectangle.
This is calculated as
width * height
. Read moreSource§fn contains_point(&self, x: Self::Unit, y: Self::Unit) -> bool
fn contains_point(&self, x: Self::Unit, y: Self::Unit) -> bool
Checks if the rectangle contains the given point. Read more
Source§fn contains_rectangle(&self, other: &impl Rectangle<Unit = Self::Unit>) -> bool
fn contains_rectangle(&self, other: &impl Rectangle<Unit = Self::Unit>) -> bool
Checks if one rectangle contains another. Read more
Source§fn overlaps(&self, other: &impl Rectangle<Unit = Self::Unit>) -> bool
fn overlaps(&self, other: &impl Rectangle<Unit = Self::Unit>) -> bool
Checks if one rectangle overlaps with another. Read more
impl Copy for BasicRectangle
impl StructuralPartialEq for BasicRectangle
Auto Trait Implementations§
impl Freeze for BasicRectangle
impl RefUnwindSafe for BasicRectangle
impl Send for BasicRectangle
impl Sync for BasicRectangle
impl Unpin for BasicRectangle
impl UnwindSafe for BasicRectangle
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