pub struct Rect<T> {
pub origin: Vec2<T>,
pub size: Vec2<T>,
}
Expand description
A rectangle on the integer grid.
Fields§
§origin: Vec2<T>
§size: Vec2<T>
Implementations§
Source§impl<T> Rect<T>
impl<T> Rect<T>
Sourcepub fn bottom_right(self) -> Vec2<T>
pub fn bottom_right(self) -> Vec2<T>
Fetches the bottom-right corner of the rectangle.
Source§impl<T> Rect<T>
impl<T> Rect<T>
Sourcepub fn top_center(self) -> Vec2<T>
pub fn top_center(self) -> Vec2<T>
Fetches the top-center position of the rectangle.
Sourcepub fn center_left(self) -> Vec2<T>
pub fn center_left(self) -> Vec2<T>
Fetches the left-center position of the rectangle.
Sourcepub fn center_right(self) -> Vec2<T>
pub fn center_right(self) -> Vec2<T>
Fetches the right-center position of the rectangle.
Sourcepub fn bottom_center(self) -> Vec2<T>
pub fn bottom_center(self) -> Vec2<T>
Fetches the bottom-center position of the rectangle.
Source§impl<T> Rect<T>
impl<T> Rect<T>
Sourcepub fn sample_random_with(self, rng: &mut impl Rng) -> Option<Vec2<T>>
pub fn sample_random_with(self, rng: &mut impl Rng) -> Option<Vec2<T>>
Samples a random position within the rectangle with the given rng.
Sourcepub fn sample_random(self) -> Option<Vec2<T>>
pub fn sample_random(self) -> Option<Vec2<T>>
Samples a random position within the rectangle.
Trait Implementations§
impl<T: Copy> Copy for Rect<T>
impl<T: Eq> Eq for Rect<T>
impl<T> StructuralPartialEq for Rect<T>
Auto Trait Implementations§
impl<T> Freeze for Rect<T>where
T: Freeze,
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§
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