[][src]Struct ezquadtree::Rectangle

pub struct Rectangle {
    pub x: u32,
    pub y: u32,
    pub w: u32,
    pub h: u32,
}

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: u32y: u32w: u32h: u32

Implementations

impl Rectangle[src]

pub fn new(x: u32, y: u32, w: u32, h: u32) -> Self[src]

Create a new Rectangle.

pub fn top_left_corner(&self) -> (u32, u32)[src]

Get the top left most x and y of rectangle.

pub fn contains<T>(&self, item: &T) -> bool where
    T: Vector
[src]

Checks to see if a a given Vector is in the QuadTree.

pub fn intersects(&self, range: &Rectangle) -> bool[src]

Checks to see if any part of another Rectangle overlaps its self.

Trait Implementations

impl Clone for Rectangle[src]

impl Copy for Rectangle[src]

impl Debug for Rectangle[src]

impl<'de> Deserialize<'de> for Rectangle[src]

impl PartialEq<Rectangle> for Rectangle[src]

impl Serialize for Rectangle[src]

impl StructuralPartialEq for Rectangle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.