pub struct Rect<N> { /* private fields */ }
Expand description
A 2-dimensional rectangle
Implementations§
source§impl<N> Rect<N>
impl<N> Rect<N>
sourcepub fn from_left_top_right_bottom(left: N, top: N, right: N, bottom: N) -> Self
pub fn from_left_top_right_bottom(left: N, top: N, right: N, bottom: N) -> Self
Creates a rectangle from left, top, right, and bottom coordinates
sourcepub fn from_corners(top_left: Point<N>, bottom_right: Point<N>) -> Self
pub fn from_corners(top_left: Point<N>, bottom_right: Point<N>) -> Self
Creates a rectangle from a top left corner and a bottom right corner
sourcepub fn into_left_top_bottom_right(self) -> (N, N, N, N)
pub fn into_left_top_bottom_right(self) -> (N, N, N, N)
Consumes this rectangle and returns its left, top, bottom, and right coordinates
pub fn set_top(&mut self, top: N)
pub fn set_left(&mut self, left: N)
pub fn set_bottom(&mut self, bottom: N)
pub fn set_right(&mut self, right: N)
sourcepub fn contains(&self, point: Point<N>) -> boolwhere
N: PartialOrd,
pub fn contains(&self, point: Point<N>) -> boolwhere
N: PartialOrd,
Determines whether this rectangle contains a point
For this calculation, the bottom and left edges are inside the rectangle, while the top and right edges are outside.
Trait Implementations§
impl<N: Copy> Copy for Rect<N>
Auto Trait Implementations§
impl<N> Freeze for Rect<N>where
N: Freeze,
impl<N> RefUnwindSafe for Rect<N>where
N: RefUnwindSafe,
impl<N> Send for Rect<N>where
N: Send,
impl<N> Sync for Rect<N>where
N: Sync,
impl<N> Unpin for Rect<N>where
N: Unpin,
impl<N> UnwindSafe for Rect<N>where
N: UnwindSafe,
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