[][src]Struct beryllium::Rect

#[repr(C)]
pub struct Rect {
    pub x: i32,
    pub y: i32,
    pub w: i32,
    pub h: i32,
}

Rectangle struct, origin at the upper left.

Naturally, having the origin at the upper left is a terrible and heretical coordinate system to use, but that's what SDL2 does so that's what we're stuck with.

Note: This type has been rewritten in Rust.

Fields

x: i32y: i32w: i32h: i32

Methods

impl Rect[src]

pub fn contains_point(&self, px: i32, py: i32) -> bool[src]

Returns true if the point resides in this rect.

A rect is inclusive with the upper and right sides, and exclusive with the lower and left sides.

pub fn is_empty(&self) -> bool[src]

Returns true if the rectangle has no area.

pub fn intersect(&self, other: &Rect) -> Rect[src]

Gives a Rect that's the intersection between this and the other rect.

  • If either Rect in the intersection is empty you get a default Rect.

pub fn union(&self, other: &Rect) -> Rect[src]

Gives a Rect that's a union between this and the other rect.

  • If self is empty, you just get the other rect.
  • If the other rect is empty, you just get self.
  • If both are empty then you get a default rect.

Trait Implementations

impl From<SDL_Rect> for Rect[src]

impl From<Rect> for SDL_Rect[src]

impl PartialEq<Rect> for Rect[src]

impl Clone for Rect[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for Rect[src]

impl Eq for Rect[src]

impl Copy for Rect[src]

impl Debug for Rect[src]

Auto Trait Implementations

impl Send for Rect

impl Unpin for Rect

impl Sync for Rect

impl UnwindSafe for Rect

impl RefUnwindSafe for Rect

Blanket Implementations

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.

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

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

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