[][src]Struct geo_types::Rect

pub struct Rect<T> where
    T: CoordinateType
{ /* fields omitted */ }

A bounded 2D quadrilateral whose area is defined by minimum and maximum Coordinates.

Methods

impl<T: CoordinateType> Rect<T>[src]

pub fn new<C>(min: C, max: C) -> Rect<T> where
    C: Into<Coordinate<T>>, 
[src]

Constructor to creates a new rectangle from coordinates, where min denotes to the coordinates of the bottom-left corner, and max denotes to the coordinates of the top-right corner

Panics

Panics if min's x/y coordinate is larger than that of the max's.

Examples

use geo_types::{Coordinate, Rect};

let rect = Rect::new(Coordinate { x: 0., y: 0. }, Coordinate { x: 10., y: 20. });

assert_eq!(rect.min(), Coordinate { x: 0., y: 0. });
assert_eq!(rect.max(), Coordinate { x: 10., y: 20. });

pub fn min(self) -> Coordinate<T>[src]

pub fn set_min<C>(&mut self, min: C) where
    C: Into<Coordinate<T>>, 
[src]

pub fn max(self) -> Coordinate<T>[src]

pub fn set_max<C>(&mut self, max: C) where
    C: Into<Coordinate<T>>, 
[src]

pub fn width(self) -> T[src]

pub fn height(self) -> T[src]

Trait Implementations

impl<T: Clone> Clone for Rect<T> where
    T: CoordinateType
[src]

impl<T: Copy> Copy for Rect<T> where
    T: CoordinateType
[src]

impl<T: Debug> Debug for Rect<T> where
    T: CoordinateType
[src]

impl<T: CoordinateType> From<Rect<T>> for Polygon<T>[src]

impl<T: Hash> Hash for Rect<T> where
    T: CoordinateType
[src]

impl<T: PartialEq> PartialEq<Rect<T>> for Rect<T> where
    T: CoordinateType
[src]

impl<T> StructuralPartialEq for Rect<T> where
    T: CoordinateType
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Rect<T> where
    T: RefUnwindSafe

impl<T> Send for Rect<T> where
    T: Send

impl<T> Sync for Rect<T> where
    T: Sync

impl<T> Unpin for Rect<T> where
    T: Unpin

impl<T> UnwindSafe for Rect<T> where
    T: UnwindSafe

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> 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.