pub struct IRect {
pub left: isize,
pub top: isize,
pub width: usize,
pub height: usize,
}
Expand description
A rectangle with integer values.
Fields§
§left: isize
§top: isize
§width: usize
§height: usize
Implementations§
Source§impl IRect
impl IRect
pub fn new(left: isize, top: isize, width: usize, height: usize) -> Self
Sourcepub fn centered(center: ICoord, width: usize, height: usize) -> Self
pub fn centered(center: ICoord, width: usize, height: usize) -> Self
Return a new rectangle centered at the given position with the given w/h
Sourcepub fn contains(&self, pos: ICoord) -> bool
pub fn contains(&self, pos: ICoord) -> bool
Does this rect contain the pos?
Points on the boundary count.
pub fn area(&self) -> usize
Sourcepub fn contained_coords(&self) -> RectIter ⓘ
pub fn contained_coords(&self) -> RectIter ⓘ
Iterator through all the positions in the rect. It goes in reading order: left-to-right, top-to-bottom.
(Sorry hebrew speakers)
pub fn right(&self) -> isize
pub fn bottom(&self) -> isize
pub fn shifted(self, by: ICoord) -> IRect
Trait Implementations§
impl Copy for IRect
impl Eq for IRect
impl StructuralPartialEq for IRect
Auto Trait Implementations§
impl Freeze for IRect
impl RefUnwindSafe for IRect
impl Send for IRect
impl Sync for IRect
impl Unpin for IRect
impl UnwindSafe for IRect
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
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more