pub struct Rectangle {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}
Expand description
Rectangle is to represent a rectangular bounding box.
§Example
// for now it only takes a u32 but At some point will be a T.
let rect = Rectangle::new(0, 0, 40, 40);
Fields§
§x: u32
§y: u32
§w: u32
§h: u32
Implementations§
Source§impl Rectangle
impl Rectangle
Sourcepub fn top_left_corner(&self) -> (u32, u32)
pub fn top_left_corner(&self) -> (u32, u32)
Get the top left most x and y of rectangle.
Sourcepub fn contains<T>(&self, item: &T) -> boolwhere
T: Vector,
pub fn contains<T>(&self, item: &T) -> boolwhere
T: Vector,
Checks to see if a a given Vector is in the QuadTree.
Sourcepub fn intersects(&self, range: &Rectangle) -> bool
pub fn intersects(&self, range: &Rectangle) -> bool
Checks to see if any part of another Rectangle overlaps its self.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rectangle
impl<'de> Deserialize<'de> for Rectangle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Rectangle
impl StructuralPartialEq for Rectangle
Auto Trait Implementations§
impl Freeze for Rectangle
impl RefUnwindSafe for Rectangle
impl Send for Rectangle
impl Sync for Rectangle
impl Unpin for Rectangle
impl UnwindSafe for Rectangle
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